Loop node
What it does
The Loop node turns each input row into several output rows. In Foreach mode it expands a list field, so { orderId, line_items: [...] } becomes one row per line item. In Fixed count mode it repeats a row a set number of times. Each output row carries the current item and its index.
When to use
- A row holds a list, such as order lines or tags, and each element needs its own row.
- Each row must be repeated a known number of times, such as one row per month for twelve months.
- The work after the expansion is the same for every row.
Loop and Loop (container) both iterate. Pick by what happens per item.
| You want to | Use |
|---|---|
| Turn a list field into one row per item | Loop |
| Repeat each row a set number of times | Loop |
| Run several nodes once per item, shown as one block | Loop (container) |
| Repeat work while a condition holds | Loop (container) |
A Loop sends all its output rows to the next node together. A Loop (container)
runs its body once per item and collects the rows on out.
Configure
Select the node and press Configure to open Configure Loop.
Save and Done stay unavailable while a required setting is missing. Cancel discards the changes made since the dialog opened or was last saved. A message confirms each save.
Iteration mode
Foreach: expand a list field, one row per item.Fixed count: repeat a set number of times.
Foreach
- List field (array): the field that holds the list, such as
line_items.
Fixed count
- Start, Count and Step: the values to repeat over, for example Start
1, Count12, Step1. The index column holds each value, and so does the item column.
A node saved with per-row settings shows the Fixed count tile with Item from field (optional), which copies a row field into the item column.
In both modes
- Item field name: the column that holds the current item. The default is
dl_loop_item. - Index field name: the column that holds the position, starting at 0. The default is
dl_loop_index. - Keep original row fields: on by default. Off, the output row holds only the item and index columns.
Exit condition
An optional expression, such as GT(dl_loop_index, 100). When it is true, the loop stops. Insert snippet adds a ready-made condition. An expression that cannot be evaluated is treated as false.
Guards
- Max iterations: default 10,000. The loop stops when it reaches this count.
- Report every (iterations): writes a progress line to the run log every N iterations. 0 turns it off.
Ports
| Port | Direction | Kind | Notes |
|---|---|---|---|
in | in | data | Input rows. |
out | out | data | One row per iteration, with the item and index columns. |
error | out | control | Receives the input rows when the node fails. |
The run view shows the number of iterations on the Loop node.
Examples
One row per order line. Foreach on line_items, Item field name line. An order with three lines gives three rows, each with the order's fields and one line. A Transform then maps line.sku and line.qty to columns.
Twelve months. Fixed count with Start 1, Count 12, Step 1, Item field name month. Each input row becomes twelve rows with month from 1 to 12.
Troubleshooting
| Symptom | Cause | What to do |
|---|---|---|
| A row produces no output | Its list field is empty or missing. | Check List field (array) against the upstream fields. |
| A row produces one output row | The field holds a single value, not a list. | Check that the field is a list. |
| Fewer rows than expected | Max iterations or the exit condition stopped the loop. The loop stops without an error. | Raise Max iterations, or check the exit condition. |
| The exit condition never stops the loop | The expression cannot be evaluated, so it counts as false. | Check field names in the expression. |
| Output rows lack the original fields | Keep original row fields is off. | Turn it on. |