How to use the Loop function

Hi all,

I’m trying to understand how the loop function works.

Instead of copy/pasting these two steps for every path, I’d like to learn how to use the loop properly.

Could someone please assist? :slightly_smiling_face:

Hi @karla ,

You can refer to Setting Up Loops – Activepieces 101 for the loop piece. Could you also explain which task you want to use the loop for? We can help you create the step or flow.

1 Like

@kishanprmr What I’m trying to achieve is to avoid lengthy paths. Instead, if an action is repeated (for example, creating a random number or adding a delay), I want it to apply to path 1, path 2, etc.

Basically, I want to remove what’s in the red boxes and make sure it exists in the flow only once, but is reused for every path.

I’ve checked the content and the video, but I still don’t understand where to place these steps or how to connect them (especially since the loop is asking for a list or similar input).

hi all,

any assistance?

The Loop piece is used when you want to iterate over some data, for example, a list of names like ['john','ray','tom'].

The steps shown in the red boxes are the same, so you can add them before the 5.Router step instead of repeating them in each branch. You will still be able to access the output of those steps inside each branch.