For each loop stops after 5 iterations

Hi,
I'm trying to create a list cell references. My BuildCellsList procedure stops after five iterations - the Notifier just shows the numbers 2 to 6.

I've got the Spreadsheets API working properly with the correct credentials.

Any help would be much appreciated.

Try this:

image

Dear @Pippin, while I was writing my code, I see that @TIMAI2 has already suggested a neat solution.
Anyway, if you want to try also mine, I've used a different approach.
The reason why "it seems" that the counter only shows up to position 5 is due to the fact the warnings take time to be accomplished, therefore the for loop finishes far before the warnings (notifiers) can accomplish their task because each warning takes more than 500 ms to appear-show the message-disappear.
Moreover putting two warnings consecutively produces a hiding of the first, and only the second is shown (or vice versa, depending on the timings).
In a nutshell, the for loop does not wait for any warning to finish its task.
So I've implemented a double clock system and a couple of labels that are displayed/hidden according to the firing periods of the two clocks.
Clock1 has a 200 ms period and is used to create a new position, and in my example also a new fake-phone number.
When it fires, it shows the two labels displaying a) the position in the list and b) the relevant Phone Number and it activates the clock2, which represents the time for which the labels are shown (1000 ms). After 1000 ms the Clock2 hides the two labels and activates the Clock1 that is allowed to fire again, thus creating a new position (and a new phone number) in the next 200 ms..
I believe that if you take a look to the blocks is much more easy to understand.
Hoping it helps.

For_Loop.aia (3.4 KB)

Thanks TIMAI2. That works.

Thanks uskiara. I've seen replies to similar posts that just say "use the Clock component", with no further help. Your blocks make it clear! I'll try it out as an alternative.

1 Like

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