Loop block
The Loop Block allows iterating over items in a list. This is handy when you want to process items (records) one by one.
All the blocks inside the Loop will be executed multiple times, depending on the number of items in the list.
You can use the block Exit loop
to stop processing the items in the loop, e.g. in combination with a Condition
Block.
Note that list
blocks (where the output is a list) have a built-in loop, which acts the same way, and avoids the need to add a separate loop block. Example:
See also Using Loops.
Placeholders to access the item in the loop and the index
The input of the loop block should be a list. Inside the loop you can use the placeholder { $.loop.item }
to reference the current item from the list that is being used. Example:
Same example in raw view mode
:
Index
The placeholder { $.loop.index}
can be used to get the index of the current item, starting with 0 for the first item (0, 1, 2, 3...).
Iterate over keys of an object
Note that you can also iterate over the properties of an object with key/values. In this case the placeholder { $.loop.item } will give you the value of each property, and { $.loop.index} will give you the key of each property. As always, these placeholders should only be used inside the loop.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!