Skip to main content

Aggregate Looping

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.

Information noteTip: When you map looping elements to non-looping elements, you can automatically generate the AgConcat function. A dialog box requests you to select either of these actions: Change the output map element looping or Generate AgConcat value expression on <elementvalues>?. If you select the second action, the AgConcat function is automatically added in the value expression of the target Output map element with a generated loop expression and, if possible, a single index filter.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!