Iterator
Description
Section titled “Description”The Iterator module receives a data array and executes the following workflow nodes for each element of the array in parallel. Each element is processed independently with its own metadata (_meta_) that includes the current index, total number of elements, and a unique execution identifier. If the input data is not an array but is an object with numeric keys, it is automatically converted to an array. It is the fundamental node for batch processing in workflows and must be combined with a merge node (mergeResults, mergeIterator) to recombine the results.
Configuration
Section titled “Configuration”Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| expression | text | No | Expression that returns the array to iterate over. By default, data is used directly. |
Output
Section titled “Output”{ "_iterating": true, "batch": [ { "_meta_": { "workflowRunId": "1679561234567", "totalChunks": 3, "currentChunk": 0, "currentIndex": 0 }, "data": { "nombre": "Item 1" }, "nextModule": "siguiente_modulo" }, { "_meta_": { "workflowRunId": "1679561234567", "totalChunks": 3, "currentChunk": 1, "currentIndex": 1 }, "data": { "nombre": "Item 2" }, "nextModule": "siguiente_modulo" } ], "data": { "summary": [ { "poscurrent": 0, "status": "pending", "record": { "nombre": "Item 1" } }, { "poscurrent": 1, "status": "pending", "record": { "nombre": "Item 2" } } ], "workflowRunId": "1679561234567" }}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "label": "Iterator", "expression": ""}- Input data must be an array. If an object with numeric keys is received (e.g.:
{0: "a", 1: "b"}), it is automatically converted to an array. - If the data is not an array or a convertible object, an error is returned.
- Each element of the array is passed individually as
datato the next node. - The
workflowRunIdis generated from the current timestamp (Date.now()). - Returns
_iterating: truewith abatcharray so the engine executes each element in parallel. - The batch’s
nextModuleisnullat the root level to prevent automatic continuation; each batch element contains its ownnextModule. - The
expressionfield allows specifying a custom expression to obtain the array to iterate over, althoughdatais used by default. - Concurrency: batch items execute concurrently up to
maxConcurrent(default: 5). Each item follows the full module chain independently until it reaches a merge node ornull. - Source tracking: when an item’s chain calls a downstream module (e.g.
mergeMultiple), the engine passessourcein the config identifying which preceding module sent the data. This allows merge nodes to correctly distinguish inputs from different branches. - Items absorbed by merge nodes: if all batch items reach a
mergeResultsormergeMultiplenode and are absorbed (i.e. the merge is still collecting), the iterator returns normally without raising an error. The summary correctly reportssucceeded: Nrather than treating absorbed items as failures. - Canvas progress badge: each node in the batch chain displays
N/M(current item / total items) in real time on the canvas while the batch is running. - The loop body is visible in the editor: an outline marks which nodes run for each item, and a dashed line links the iterator to the node that closes it. Watch out for one detail: the engine closes at the first
MergeIteratorin the chain, so chaining several merges does not close one level each. See Seeing loops on the canvas.
Related Nodes
Section titled “Related Nodes”- MergeResults - recombines the iteration results
- MergeIterator - simplified iteration merge
- Repeater - generates N repetitions instead of iterating an array
- Merge - basic chunk merge
- Node Compatibility with the Iterator - which nodes work inside an iteration and which don’t