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.