All nodes/Logic & Flow/Iteration

Map

Iterates over a JSON array from the ED port 'Input'. For each element it runs the item→end subgraph and collects the raw value from the end port into an output array (order matches the input array). The node's result is that array itself. Optionally runs iterations in parallel with a concurrency limit.

Map
ArrayResult
ItemItem

Type in the graph: map

ExecSubgraph

An error branch can be enabled (expose_error_output) to handle failures on their own path.

Ports can be split into separate execution and data handles.

Try it

Transforming every element

The body returns a new value for an element, and the node collects those values into an array in the same order.

Entry
Template
Map
Template
Exit
  • Execute + Data
Press “Copy nodes”, open the editor and hit Ctrl+V on the canvas.

Runs as pasted

When to use it

Reach for this node when each element of an array has to become a new value and those values have to be collected: a summary per review, a field per API row, a list reshaped into another format. When only side effects are needed, use for_each; when elements are kept or dropped rather than changed, use filter. A transformation that fits into one expression is cheaper as a template with Jinja filters or a code_javascript node; the loop earns its place when the body calls a model, calls a service, or branches.

How it works

input (Array) carries the array and the run trigger. item (Start) opens the body, end (End) closes it. Whatever lands on end goes into the output array — one value per element, in the original order. The node’s result is that array, {{ nodes.<id>.output }}, and completed (Done) fires once everything is collected.

With “Include index” off the element arrives on item as it is, read as {{ inputs.input }}. With the flag on it arrives as {<item key>: value, index: N}{{ inputs.input.item }} and {{ inputs.input.index }}.

“Parallel execution” schedules iterations concurrently, but each body runs under a shared lock, so inner nodes always see consistent data. The order of results matches the input in either mode.

Common mistakes

  • An object on the input instead of an array. Put a template with {{ inputs.input.items | tojson }} in front of the loop; the validator warns about this wiring in advance.
  • Expecting a linear speed-up from parallel mode. Iteration bodies do not overlap, so ten model calls will not become ten times faster.
  • An open body. An edge out of item and an edge into end are both required.
  • A loop inside a loop. Nested loops are rejected by the validator: sequence them, or move the inner walk into code_javascript.
  • An edge leading out of the body. Anything continuing from a body node runs on every iteration; build the rest of the graph from completed.
  • Reading elements through nodes. {{ nodes.<body node>.output }} outside the loop holds the last iteration only; the whole result is the map node’s own output.
  • One failed iteration stops the loop and the collected array is never returned.

Inputs

PortWirePayloadNotes
ArrayinputExecute + Dataexecute_data

Run trigger and array payload (JSON array or string encoding an array).

ItemendExecute + Dataexecute_data

End of subgraph for one item; return value from inner graph.

Outputs

PortWirePayloadNotes
ResultcompletedExecute + Dataexecute_data
ItemitemExecute + Dataexecute_data

Configuration

FieldTypeDefaultDescription
Include indexinclude_indexbooleanfalse

When true, each iteration passes a dict {item_key: element, index: n} on the item port. When false, the item port carries the array element value directly (no wrapper dict).

Item keyitem_variablestringitem

Key for the current element in the payload dict (with index) on the item port.

shown when include_index = true

Max concurrencymax_concurrencyinteger10

Maximum parallel subgraph runs when parallel_execution is enabled.

Parallel executionparallel_executionbooleanfalse

Schedule subgraph iterations concurrently; each run still holds a global lock so inner nodes see a consistent payload (map/filter only).

Shared fields

Every node has these three — the platform adds them, not the node author.

  • expose_error_output — When enabled, show an execution output to connect nodes that run if this step fails.
  • split_ports_in — Show separate execution and data input handles instead of one combined port.
  • split_ports_out — Show separate execution and data output handles instead of one combined port.