Hello, I am using the Airtable API in javascript. Currently I am using the select method based on the documentation, and I am trying to make use of the returned data outside of the method.
For example this is my code:
base('TestData').select({
view: 'Grid view',
filterByFormula: `{FUS} = "F002"`
}).firstPage(function (err, records) {
if (err) { console.error(err); return; }
records.forEach(function (record) {
PAISearch = record.get("PAISearch");
});
});
console.log(PAISearch);
When I try to make use of the PAISearch variable that gets declared in the return of the select method, I can't get it to be accessible under the Global scope.
I would like some advice on how to use the select method to store data into global variables for use in other functions. This works great if I just want to log to console inside of the function, but I need to make use of them elsewhere.
I understand this is probably some basic JS fundamentals, as I am still learning. Thanks!