Thunkable X AirTable - trouble getting values into a variable

Why does this work:

(i.e. read a cell into a Label)

… but this does not (i.e. read a cell into a variable, then have the Label show the variable):

Scratching my head!!! I’d like to parse some of the content within my Airtable. Here’s the Airtable structure:

It’s almost like the spreadsheet results don’t have scope beyond the spreadsheet block.

Does it work if you place the “from Label1 set Text to app HINB” block inside the “then do” section?

Yes, this works:

but this doesn’t:

… and I’d like to populate a value that I can use later (e.g. parse apart in a function for example).

Just make sure the variable is assigned in the “then do” section and it will assign properly. Then whatever function you may run needs to be nested in that block as well.

If for some reason you can’t nest the function in that block, you could also just fetch all this data on a separate “loading” screen (maybe use a Lottie animation) and fetch all the data and store it in variables. Then, when you nest the “Navigate to…” block, all the variables will be set before the actual screen loads.

If the function can’t be nested because it’s run via a button, just set the button to disabled, and enable the button in the “then do” section of the block.

The problem arises because the “set label to” block runs synchronously with the Spreadsheet GetCell block when it’s outside of the “then do” section. You have to put it in the “then do” for it to run asynchronously. In the testing I just did, it takes around 700 milliseconds for that data to populate, so you could also put a “wait 1 second” block between the Spreadsheet GetCell block and the “set label to” block, but that could make for a bad user experience if your user’s connection isn’t fast enough, or if Airtable doesn’t respond quickly enough.

Great reply @Kyle_Williams, thanks for the insight.

I’m looking to populate a Google Chart with the spreadsheet’s data. I had just assumed I could extend the data scope outside of the spreadsheet block, but as I see the issue you’ve described I believe I can keep everything within the spreadsheet block.

1 Like