Advanced Mapping (Arrays, Iterators, Aggregators)

Created by Reachware Support, Modified on Thu, 2 Apr at 2:05 PM by Reachware Support

For advanced array processing beyond simple mapping, use Iterator and Aggregator logic processors to apply complex transformations to each item, filter items based on dynamic conditions, perform calculations on each item separately, and combine results after processing.

loopOverItems

Quick mapping for simple arrays

Iterator & Aggregator

Advanced processing for complex scenarios

Iterator & Aggregator Flow

Source — provides the array
Iterator — one item per loop
Process — your custom logic
Aggregator — merges back
Destination — final output

How Iterator Works

Iterator splits an array into individual objects, allowing each item to be processed separately through the flow.

What happens:

1

Iterator receives the array from the source

2

Splits the array into separate objects

3

Each object flows through subsequent operations

4

Each item is processed independently

How Aggregator Works

Aggregator combines individual objects back into a single array after each item has been processed.

What happens:

1

Receives processed objects from Iterator

2

Combines them into a single array

3

Outputs the complete array to the next operation

Nested Arrays Example

Source data contains arrays inside arrays with line items need to use a two-level Iterator strategy.

Input:

[
  {
    order: "ORD-001", customer: "Alice",
    items: [
      { sku: "A", price: 100, qty: 2 },
      { sku: "B", price: 50, qty: 1 }
    ]
  },
  {
    order: "ORD-002", customer: "Bob",
    items: [
      { sku: "C", price: 200, qty: 3 }
    ]
  }
]

Two-level Iterator strategy

Outer Iterator

Loops over orders

Loop 1 → ORD-001 (Alice)
Loop 2 → ORD-002 (Bob)

Inner Iterator

Loops over each order's items[]

ORD-001 → sku:A (qty:2, $200)
ORD-001 → sku:B (qty:1, $50)
ORD-002 → sku:C (qty:3, $600)

Inner Aggregator → Outer Aggregator

Inner collects line totals per order. Outer recombines all orders into the final array.

Output:

[
  { order: "ORD-001", customer: "Alice", orderTotal: 250 },
  { order: "ORD-002", customer: "Bob", orderTotal: 600 }
]
Iterator and Aggregator Flow

When to Use What

SituationUseWhy
Extract a single field from all itemsloopOverItemsSimple mapping, no per-item logic needed
Calculate a value per item (price × qty)Iterator & AggregatorEach item needs its own computation step
Filter items by a conditionIterator & AggregatorUse a Router or Filter node between them
Call an API once per itemIterator & AggregatorEach item triggers an independent HTTP call
Process nested arrays Iterator & AggregatorNest a second Iterator inside the first

Related Topics

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article