Skip to content

Iterator

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.

ParameterTypeRequiredDescription
expressiontextNoExpression that returns the array to iterate over. By default, data is used directly.
{
"_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"
}
}
{
"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 data to the next node.
  • The workflowRunId is generated from the current timestamp (Date.now()).
  • Returns _iterating: true with a batch array so the engine executes each element in parallel.
  • The batch’s nextModule is null at the root level to prevent automatic continuation; each batch element contains its own nextModule.
  • The expression field allows specifying a custom expression to obtain the array to iterate over, although data is 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 or null.
  • Source tracking: when an item’s chain calls a downstream module (e.g. mergeMultiple), the engine passes source in 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 mergeResults or mergeMultiple node and are absorbed (i.e. the merge is still collecting), the iterator returns normally without raising an error. The summary correctly reports succeeded: N rather 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 MergeIterator in the chain, so chaining several merges does not close one level each. See Seeing loops on the canvas.