Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Jun 23, 2020 01:39 PM
Hi everyone,
I really like Airtable and the fact there is a community forum is amazing! I found this example https://github.com/nicroto/airtable-scripts/blob/master/update-stock.js and I’m trying to play around with it in the code editor. Although I’m stuck on nomenclature. With base.getTable, do I use the name of the base? I’m getting an error even trying to run the example. Thank you in advance for any and all help.
Jun 23, 2020 03:41 PM
Hi Devon, and welcome to the community!
No.
As indicated in the docs, a Base
provides an entry point to all of the data in a given base. There is only ever one base available — the base that’s open and in which your scripting block is written or installed. It can be accessed via the base
global variable.
As such, a simple snippet like this … opens the “Airdrop” table and reads all of the records into an object.
let table = base.getTable ("Airdrop"),
records = await table.selectRecordsAsync ();
The next line allows you to inspect the records object. The rest is uphill all the way, like golf. :winking_face:
output.inspect(records);
Jun 23, 2020 04:00 PM
Hi Bill,
Thank you for the welcome and thank you for the response! I’ll work on this.