Value of variable app in functions (purple blocks)

Hi

I’ve builded a quite complex app with different external connectinos such as APIs and airtable and, in order to track the process im creating a log functionality.

The idea is to use a airtable table with different columns where ill write some information of different parts of the process. In this case a have 6 moments id like to track therefore ive create 6 columsn in my airtable and 6 app variables.
image

When a button is pressed there are some functions i call which will execute get and/or set methods in airtable, so i setup the value of the corresponding app variable in case of error or success. Attached an example.

The function actulizanNumTarjetas will be called upon a button clicked after several other calls to similar functions (updating or retrieving airtable information). Is there is no error in the airtablemethods ill set the varaible with OK, if there is an error ill set yhe variable with the error.
image

At the end of the main event, i call a createRow method to insers all the different variables;

My issue is that not all the variables are populated in Airtable but the process has executed correctly

Can it be due to sinchronization issues? Are the app variables behaving different when changing its value inside a function block?

Thanks!

The Create Row blocks takes time to create a row in an external data source such as Airtable. If it’s in a loop, make sure each loop iteration has time to complete that function block. You might try adding a Wait block after the Create Row block and test it with 0 seconds, 0.03 seconds, 0.1 seconds, etc. to see where the threshold is for delay.

That’s especially likely because you have a Navigate block after the Create Row block. That’s going to fire immediately after the Create Row block fires, not after the Create Row block finishes. You need to move that navigate block into the “do” section of the Create Row block to ensure it happens after the Create Row function completes. You might not even need a Wait block at all if you do that.

Thanks Tatiang

But still some other variables are correctly populated in the debug DB. Ill check adding some waits and moving the blocks into the “do” section to confirm everything has finished before writting the debug variables.

Hi

Ive updated my functions so that i ensure any setCell block will not continue untill its completed to keep the process synchronous. And as you can see in the screenshot, i set the debug app variables i initialize when opening the screen depending if there is and error or not

Still when calling the crearLog function which will create a new row is not populating the right values

Screenshot of the airtable where some columns have the initiallited value instead of the one set inside the functions…

Any idea why this behaviour? Does the values set in app variable inside a function only remain inside that function?

Solved.

The issue is about timming, we know the airtable setCell works asynchrously and as i had no Wait timers (and my synchronous method is not working correctly) during the process, it was ending before the variables had their new value written.
After i’ve added a Wait N seconds, everything is working correctly.

For this issue to not happend you need to confirm that any setCell function that is part of a secuential process is completely synchrnous.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.