Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: New to Airtable and testing out scripting blocks, need some insight on understanding the Airtable specific Classes and Methods

646 0
cancel
Showing results for 
Search instead for 
Did you mean: 
DeVon_Thompson
4 - Data Explorer
4 - Data Explorer

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.

2 Replies 2

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);

image

DeVon_Thompson
4 - Data Explorer
4 - Data Explorer

Hi Bill,

Thank you for the welcome and thank you for the response! I’ll work on this.