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.
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.
At the end of the main event, i call a createRow method to insers all the different variables;
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.
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.
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
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.