Flows/Utilities/Iterators/Array Aggregator

Array Aggregator

Consolidate multiple bundles into a single array output

Overview

The Array Aggregator utility collects bundles from an iterator and combines them into a single array output. This is the counterpart to the Array Iterator - while the iterator splits arrays into individual items, the aggregator combines items back into an array.

Use this when you need to process items individually but want to work with the collected results as a group afterward.

How It Works

[Iterator] ──▶ [Process] ──▶ [Array Aggregator] ──▶ [Single Bundle]
    │              │                │
    ▼              ▼                ▼
  Item 1    Processed 1         [
  Item 2    Processed 2           Processed 1,
  Item 3    Processed 3           Processed 2,
                                  Processed 3
                                ]

The aggregator waits for all iterations to complete, then outputs a single bundle containing an array of all collected items.

Configuration

Source Module

Required. Select which iterator's bundles to aggregate. This links the aggregator to a specific iteration context. In nested iterators, this determines which level to aggregate from.

Aggregated Fields

Define one or more fields to collect into arrays. Each field has:

Name

The output field name (e.g., names, emails).

Value

Template to extract the value from each bundle.

{{#3.email}}

Default: { name: "items", value: "{{$}}" } - collects entire bundle.

Output

Outputs a single bundle with arrays named according to your configuration. The output field names match the name you defined in Aggregated Fields.

Example output:

// With aggregatedFields:
// [{ name: "names", value: "{{#2.name}}" }, { name: "emails", value: "{{#2.email}}" }]

// Output:
{
  names: ["John", "Jane", "Bob"],
  emails: ["john@example.com", "jane@example.com", "bob@example.com"]
}

Each configured field becomes an array in the output containing all collected values.

Examples

Example 1: Collect Multiple Fields

Aggregate names and emails from user data processed through an iterator:

Source Module:Iterator (#2)
Fields:
{ name: "names", value: "{{#3.name}}" }{ name: "emails", value: "{{#3.email}}" }

Output: { names: ["John", "Jane"], emails: ["john@", "jane@"] }

Example 2: Collect Entire Bundles

Use the default configuration to collect entire bundle objects:

Fields:{ name: "items", value: "{{$}}" }

The {{$}} template captures the entire current bundle.

Example 3: Accessing Aggregated Results

After aggregation, access the arrays in downstream nodes:

// If aggregator is node #4:
All names: {{#4.names}}
First name: {{#4.names[0]}}
Email count: {{#4.emails.length}}

Tips

Tip: Place the aggregator at the point where you want iterations to converge. Everything after it runs once with the collected results.

Tip: Use {{#N.fieldName.length}} to get the count of aggregated items.

Note: The aggregator waits for ALL iterations to complete before outputting. Long-running iterations will delay the aggregated result.

Note: In nested iterators, make sure to select the correct Source Module to aggregate from the intended iterator level.

Array Aggregator Utility - Flows Guide - Serenities