For loop execution time

I have a 1000 row google sheet as Datasource.
In a for loop I’m populating a list performing a test for every element of the list
But it takes a very long time to execute the for loop.
Is it a web preview problem or a for loop problem?
In this example I only increment a counter at every for loop iteration.
It takes almost 10 seconds to scan the 1000 elements list (and it shows only the final 1000 value instead of an incrementing value, but i suppose this can be a problem with screen updating in the web preview)
Don’t care about “linee” app variable, that should be the final list but in this example I’m not using it having noted the slowness of the procedure.
image

Thank you!

what is the default value of app variable contatore

The default value is 0

If only you put the default value to 0 and set the code to increment to the length of the list then you will get 1000 only

What?
As you can see, I’m incrementing CONTATORE every iteration. So I get the incrementing value at every iteration (and it is so if I insert a delay), no problem about that, that is not my problem.
The problem is that it takes 10 seconds to reach the value 1000.

Try setting the list of values from your spreadsheet to an app variable then iterate that variable.

1 Like

It seems to work this way.
image

Now the question is, WHY? I expect the for loop to call the list of values only the first time it execute…

App variables are significantly faster. I often convert stored variables to app variables as well.

1 Like

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