Hi I’m trying to create a loop that repeats N times with an interval of X seconds. My example (see attached figure) executes N times but without the interval? How to improve?
Hi @felixvboxtel —
What you are seeing is expected. Repeat and For loops in Flows are designed to be asynchronous to improve performance when running over large amounts of data. This means that multiple instances of your loop logic can be running at the same time (e.g. index 1 and 2). This also means that your DELAY block at the end does not prevent the next index from running.
If you want to build a flow where the next iteration runs only after the previous has finished, you should do something more similar to this screenshot.
To explain what you are seeing: the delay triggers each time a new input is provided. There are two ways a new input is provided, when the flow starts it is guaranteed to start one due to the connection to start. Then, it will trigger again each time the connection from display is activated.
Thnx, indeed this was my initial implementation but I also want to only execute a limited amout of loops. How can I achieve that?
@felixvboxtel
I think I was able to do pretty much as you wanted like this:
This loop wait for the delay block to be done before the next iteration.
You can limit the amount of loop by changing the number used as condition in the IF block and change the delay for the time you need.
Hope it helps you