Iterator + Passing Data to Actions after Iterator

Hi Team,

I want to use an iterator to run an action e.g. 10x times, and then after getting the result of these 10 iterations, continue the scenario with this batch of data ready for the next steps, let’s say with actions A and B

I do not want to run the actions A and B within the iterator, but after all the iterations have finished

Currently, I’m failiing to move the data from the top edge of the iterator (once those actions are done) to the one to the right of the iterator.

Can someone guide me?

Thanks a lot!

1 Like

You can use the Set Variable node to build an array within the iterations. Then use Get Variable to the right of the iterator to retrieve the accumulated data.

1 Like

Hi! Let me show you how to do this.

To get all iteration results in a single response, we need to create an intermediate buffer (let’s call it a collector), such as a local or global variable. This is done using the ADD operator at the end of each iteration cycle.

In other words, with each new iteration, you update the variable by adding the new data to it.

Here’s an example:
(We created a template with an example to help you better understand how to work with it.)

In the iterator, we add the values we’ll be iterating over.

The top connector of the iterator is connected to a node where the data will be saved (this will be the final step in each iteration).

On the right connector, there’s a “get variables” node, which retrieves the data set we’ve created and passes it along according to your logic.

You can read more about using the ADD operator in detail here: 12.03 Using SetVariables node and the add operator | Latenode

Or you can copy and explore this template to see how it works in practice: Example of using SetVariables node and the add operator

2 Likes

Here’s an even simpler demonstration.

As you can see, by setting up this logic, with each new iteration, the array from the “collector” node will store each new value and then return it via the “get variables” node.

1 Like

Thanks a lot @Raian! I really appreciate your help!

1 Like

@Raian I just made it work. Thank you very much!

Could you share more about the GetVariables node, and why do we need it?

Glad I could help!

In brief, it is used only in conjunction with Set variables (and even then, not always). Its primary purpose is to provide access to necessary variables at any point in the scenario, such as in other branches, etc.

It is quite rarely used; in most cases, the standard Set variables is sufficient.

2 Likes