For each
Goes through a list one item at a time. Each pass leaves by body with the item; when the body leads back here, the next item goes. After the last one it leaves by done.
Kind
control:foreachGroupFlow
Credits0.1 credits
Ports out2
How it looks
Settings
| Setting | Required | What it does |
|---|---|---|
| Listcollection | Yes | Where the list is in the run, like trigger.payload.readings or the json a URL answered with. |
Ports
| Port | The run leaves by it when |
|---|---|
body | Once per item. Connect the last node of the body back to this node. |
done | After the last item, or at once for an empty list. |
What it adds to the run
Later nodes can read these, in a condition or as {{name}} in a text field.
| Value | Holds |
|---|---|
item | The item for this pass. |
index | Its position, from 0. |
One at a time or all at onceFor each waits for each pass before the next. To handle every item at the same time, use For each, in parallel.
Problems you might see
| Code | Means |
|---|---|
FOREACH_COLLECTION_NOT_ARRAY | The value at List isn't a list. |
Problems found when you publish stop the publish and point at the node. Problems while a run is going fail the node, and its On failure setting decides what happens next. See the error codes for the API's own.
See also
Runs the body for every item at once. An empty list leaves by empty.
Outbodyemptycontrol:parallelForEachCalls any HTTP endpoint, with an HTTP auth integration if it needs one. Errors leave by error.
Outdefaulterroraction:webhookSets, increments or compare-and-sets a variable, local to the run or shared by every run.
Outdefaultcontrol:variable