3.4Iterators, aggregators & transformations
The essentials in 30 seconds
- The iterator unfolds: it goes through a list and runs the following actions for each item (one row per item).
- The aggregator gathers: it merges several items into a single value (total, summary, concatenated text).
- Transformations clean: formatting a date, a text or an amount so the data arrives clean in the target app.
Running case — Lina consolidates order lines
Lina, digitalisation officer in Oran, receives orders where each response contains several items: her scenario only took the first one and forgot the rest. She adds an iterator that unfolds the list (one row per item), transformations that clean (formatted dates, rounded amounts, uppercased names), then an aggregator that produces the total and a text summary sent in a single message. Split to process, group to present.
This same case returns in the lesson, the diagram, the script and the 48h challenge.
1. Iterator and aggregator: split then group
Real data often arrives in batches: an order contains several lines, a message several attachments, an API response a list of items. The iterator “unfolds” a list and runs the actions for each item (create one row per ordered item). The aggregator does the opposite: it gathers several items into a single value (merging rows into a summary, adding up, concatenating).
The warning sign: an “array” data item or a “[ … ]” in the results. Without an iterator, the scenario often takes only the first item; with the iterator → aggregator pair, Lina processes each item then returns a consolidated result.
2. Transformations: delivering clean data
Add transformations: cleaning and reformatting data along the way — formatting a date, uppercasing, extracting part of a text, converting a format, calculating. These functions, often close to a spreadsheet, guarantee that the data arrives clean and usable in the target app.
Iterators, aggregators and transformations are what make it possible to handle realistic cases (not just one isolated field), and so to build automations robust enough for business processes.
🔎 Concrete example — Order lines consolidated
Lina applies the iterator → aggregator pattern.
Trigger returns a list (items)
Iterator: create one row per item
Transformation: round, format the dates
Aggregator: total + text summary → a single message
Reading: each item is processed, then everything is consolidated.
Lesson: a “[ … ]” in the data = need to iterate.
Section vocabulary
- Iterator
- Module that goes through a list and runs the following actions for each item (one by one).
Simple example: Lina creates one row per item of the order.
What it is not: a module that merges everything into one value.
Reflex: add an iterator as soon as you see a [ … ].
- Aggregator
- Module that gathers several items/results into a single value (merge, sum, concatenation).
Simple example: Lina's total and text summary in one message.
What it is not: going item by item.
Reflex: finish with an aggregator when you want a single result.
- Transformation
- Operation that reshapes data along the way (formatting a date, extracting text, converting, calculating).
Simple example: Dates formatted and amounts rounded before sending.
What it is not: sending raw source data.
Reflex: clean before the final action, never after.
- Array
- List of data (order lines, items of an API response) that the iterator unfolds.
Simple example: The list of items received in the order.
What it is not: a single isolated field.
Reflex: spot the [ … ] brackets in the results.
- Bundle
- Individual item produced at each iteration round, to which the actions apply.
Simple example: Each item processed one by one by Lina.
What it is not: the whole list processed as one block.
Reflex: check one test bundle before generalising.
In practice — Processing lists and transforming data
- Start from a trigger returning a list (e.g. order lines, or several records).
- Add an iterator to go through the list and create one action per item (one row per item).
- Use an aggregator to produce a summary (total, concatenated text) from these items.
- Insert transformations: format the dates, clean the text, round the amounts before the final action.
Ready-to-say script — explaining batch processing (30 s)
“The order arrives as a list: my iterator unfolds and creates one row per item, my transformations clean dates, texts and amounts, then my aggregator produces the total and the summary in a single message. We lose no item anymore and we deliver clean data.”
To say in a team review; show a 3-item order processed end to end.
Copy-paste template — iterator → aggregator batch sheet
SOURCE LIST (array field spotted): _______________
ITERATOR (1 action per item): _______________
TRANSFORMATIONS (dates / text / amounts): _______________
AGGREGATOR (total + single summary): _______________
SMB / freelancer
Even at small volume: iterating over attachments one by one avoids omissions.
SME in Oran
Lina consolidates the day's orders into a single summary sent to accounting.
Digital team
Standardise formats (dates, amounts) in transformations for always-clean databases.
Beginner
Practise on a 3-item list: iterate, transform one field, aggregate a total.
✓ Best practices
- Iterate as soon as data arrives as a list (array).
- Combine iterator → aggregator to consolidate a result.
- Clean/format data before the final action.
✗ Common pitfalls
- Processing a list as a block (taking only the 1st item).
- Forgetting to format (dates, text) before the target action.
- Iterating when each run concerns a single object (useless).
Key takeaways
- The iterator unfolds a list and runs the actions for each item.
- The aggregator gathers several items into a single value (merge, sum, concatenation).
- Transformations reshape the data (dates, text, conversions, calculations).
- These modules make it possible to handle realistic cases (lists, batches), not one isolated field.
48h challenge — apply tomorrow
Spot 1 list in your data and add an iterator + 1 transformation (date or amount).
- I can spot an array [ … ] in the results.
- I know how to iterate then aggregate a result.
- I clean dates and amounts before the final action.
Frequently asked questions
When do I really need an iterator?
As soon as the trigger (or a step) returns several items and you want to act on each one: several items in an order (create one row per item), several attachments (save them one by one), a list of records to process. Without an iterator, the scenario would often take only the first item, or process the list as an shapeless block. The warning sign: you see an “array” data item or a “[ … ]” in the results. That is the time to iterate. Conversely, if each run concerns a single object, the iterator is useless.
Iterator then aggregator: what is this combination for?
It is a very common pattern: you unfold a list to process/transform each item (iterator), then you gather the results into a single output (aggregator). Example: from order lines, you compute the subtotal of each (iteration), then add them up and generate a text summary (aggregation) to send by message. “Split to process, group to present”: this iterator → aggregator pair is one of the most powerful patterns for cleanly handling batch data, while producing a consolidated, readable result.
What is an iterator for?