Transformers

For Each

Runs everything downstream once per item in a list, then carries on.

transformer.for_each
TRANSFORMFor Each

At a glance

Takes
A payload holding an array
Emits
item, _forEach_index, _forEach_count on Loop; _forEach_results on Done
Good for
Processing every file, row, or result an upstream node produced

Set it up

Pick the list in Loop Over — the dropdown offers the arrays upstream nodes publish. Wire the orange Loop outlet to the work you want repeated and the green Done outlet to whatever happens afterwards. Iterations run one at a time, in order.

The inspector for For Each: which list, what to call each item, what to do on an error.
The inspector for For Each: which list, what to call each item, what to do on an error.

Configure

FieldDefaultWhat it does
Loop Over—The payload key holding the array.
Each Item AsitemThe name each element takes during the loop — {{item}} downstream.
On ErrorStop on First ErrorContinue All runs the remaining items even after one fails.

Output

Every key is available downstream as {{key}}.

KeyOutletValue
itemLoopThe current element, with its real type intact. Renamed by Each Item As
_forEach_indexLoopZero-based index of this pass
_forEach_countBothHow many items there were
_forEach_resultsDoneAn array holding each pass's final payload, in order

Each pass starts from the node's own input merged with the item, so upstream keys stay reachable inside the loop.

Example: log every item in a list

Input hands the flow a JSON list. For Each loops {{items}}. Template builds 1 of 3: beta from {{_forEach_index}}, {{_forEach_count}} and {{item}}, and Log records each pass.

Four nodes: a list in, one pass per item, a line logged each time.
Four nodes: a list in, one pass per item, a line logged each time.

Paste this into the Flow Builder to get the same flow:

Take a JSON list from an Input trigger, loop over it, and log each item with its position.

Good to know

A missing key means zero iterations. The Loop outlet never fires and the payload continues straight out of Done. A key holding a single value that isn't an array runs exactly once, wrapped as one item.

Done carries the loop's results, not the last item. _forEach_results is built from the final node of each pass, so aggregate work belongs after Done rather than inside the loop.

Every pass is its own log block, numbered, streaming as it completes. The node card on the canvas shows the latest pass.