Aggregate Looping - 6.3

Talend Data Mapper User Guide

Talend Big Data Platform
Talend Data Fabric
Talend Data Management Platform
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
Design and Development
Talend Studio

Non-aggregate functions execute in the looping context of their enclosing expression and output map element. Sometimes it is necessary to access data from an unrelated loop, for example, you might want to take the sum of all values from the input. Use aggregate functions for this. Each aggregate function allows you to specify a loop expression for each of its arguments, creating a new loop context for each argument.

The loop expression for an aggregate function is always the first argument of each argument of the function. In the LoopAggregate example, the value expression for TotalNotices counts the number of Notices/Notice/Num elements in the output.

Note the loop expression below the map element reference to Notices/Notice/Num. That is where the loop expression is placed. In this case, the loop expression is a reference (LoopReference) to the loop expression of the output element Notices/Notice/Num.