Help

Re: Basic Tutorial on Functions

3633 3
cancel
Showing results for 
Search instead for 
Did you mean: 
ATG
6 - Interface Innovator
6 - Interface Innovator

Is there a sample code snippet to pass table records into a function? Do I also need to pass the table or field itself (because I need the field to get cell value, or the table to get the field, right?)

16 Replies 16

Thanks, the example is very helpful.

It probably should be documented what types are returned when getCellValue is called on different fields. That belongs in Airtable Scripting Block documentation - it’s not a Javascript not easy issue. If all functionality such as date processing are reliant on Javascript itself then by default it should return a Date object instead of a string, etc.

It is there, @ATG – it’s in the “Cell values & field options” section, which is linked to from the record.getCellValue() documentation:

image

image

Can I chime in with my thoughts on the Scripting Block documentation?

I think that the information in the Scripting API documentation is excellent.

  • It contains a wealth of very detailed information.
  • Being able to easily copy code examples is awesome.
  • The examples are generously scattered throughout the documentation.
  • In several places, the documentation has links to outside reference material.
  • Some of the examples pull in actual names from the current base.
  • The formatting is (mostly) beautiful.

However, the documentation does leave several things to be desired.

  • The documentation window is tiny. This discourages people from using it. It is also very hard to see the documentation, a significant portion of code, and actual records all at the same time. When trying to put everything together, it would be nice to be able to comfortable see them all at the same time.

  • At times the documentation oversimplifies things for users who already know JavaScript (such as not differentiating between properties and methods). Yet at other times it overly complicates things for users who don’t know how to read computer documentation (parameter signatures).

  • Navigation within a section of the documentation is poorly supported. If you want to know what is covered in a section, you have to manually scrolling until you get to the info you want.

Then, there are a few minor quirks:

  • The documentation does not cover some items that I think should be covered, because they are unique to Scripting block. (I’ve run into this twice.)

  • The Scripting block does not always follow documented behavior. (I’ve run into this multiple times.)

  • The Scripting block editor sometimes is overly enthusiastic in flagging possible errors.

  • There are undocumented features. (I’ve run into one.)

ATG
6 - Interface Innovator
6 - Interface Innovator

I second this - some of the information I was looking for was there but took too much scrolling to find.

There should be a short intro laying out the principles (API only for loading updating data, use Javascript for everything else including filters instead of views, whether queries should be global variables or passed as parameters, etc); code snippets for basic things like sorting, filtering; how references/linked fields should be handled; when to calculate in Airtable formulas and when to handle in Scripting block; how to build shares libraries to extend Airtable API, common libraries to link, how to map Airtable data types to Javascript and any common issues, etc. I found the examples not to be that relevant to be honest.

Would be much easier to pick up with a quick primer like this

In 2007 Google released Google Apps Script and it wasn’t until well into the next decade that examples emerged that truly helped users grasp the the subtle differences between Google Apps Script and javascript (lowercase).

Indeed, I agree that we need better examples. but keep in mind that this new feature was created a few months ago and release from beta under great pressure from the community. It’s bound to have significant documentation gaps.

Often, we want these new features in the worst way, but we’re also annoyed when we get them in the worst condition. :slightly_smiling_face:

True, except…one is free, and the other isn’t.

Hmmm… does that really matter? They both have free tiers; they both have paid tiers.