How Do I Define Aggregates per Break Level? (Magic xpa 4.x)
To define your break level aggregates, there are 3 steps:
-
Define the aggregate variables
-
Update the aggregates
-
Zero out the aggregates
Let’s take each of these step by step.
The variables used for aggregates are usually just virtuals, and they are defined in the Data View as you would any virtual. However, with aggregates it is a good idea to have some kind of standard naming convention to make them easy to spot, because it is easy to use the incorrect variable. In this example, we added a capitalized prefix to specify which variable goes with which break level.
The easiest way to update the aggregates is to increment them all as each record is read. That way all your updating logic is in one place, which makes debugging faster.
Last, you need to zero out the aggregates. This can be done in the Group Prefix break level, or in Group Suffix after the aggregates have printed.
The Online and Rich Client Samples projects (program RP04 and RRP04)