For Each Loop
Iterates over an array or map, executing a sub-graph for each item.
This node iterates over each item in an Iterable (such as an array or a map).
Execution Flow#
- The loop starts when the
Executeinput is triggered. - For each item in the input array/map, the node:
- Sets the
KeyandValueoutput ports. - Triggers theBodyexecution output. - The
Breakinput can be triggered at any time (e.g., from within theBodyexecution path) to stop the loop. - After all items have been processed, or if the loop was stopped by the
Breakinput, theCompletedexecution output is triggered.
Ports#
- Key: For an array, this is the numeric index. For a map, this is the key.
- Value: The value of the element at the current key/index.
Inputs#
| Port | Description |
|---|---|
| Starts the loop. | |
Stops the loop. The Completed path is executed afterwards. |
|
invalid port type: iterable Input |
The array or map to iterate over. |
Outputs#
| Port | Description |
|---|---|
| Executed for each item in the loop. | |
| The index (for an array) or key (for a map) of the current item. | |
| The value of the current item. | |
| Executed after the loop finishes or is broken. |
ID: core/for-each-loop@v1