Summary CalcOnGroup Totals

TECH TIP: Calculating a Summary based on Group Totals

Question: “I am using a Variable in the Group Footer to conditionally calculate totals for each group. I want to add a second Variable to the Summary that accumulates the results calculated for each group.”

Answer: The following example uses two Variable components: vCustomerTotal and vCustomerSummary. The variable vCustomerTotal has its Timing defined to Reset on GroupEnd.

There are two options for accumulating the summary total.

1. Use the vCustomerTotal OnCalc event to accumulate the detail and the summary.


2. Set the timing of the Summary OnCalc to “GroupBeforeFooter” and accumulate the detail variable results. Note that here we use GroupBeforeFooter because the detail variable has its Reset defined as “GroupEnd” – implying that if we try to use GroupEnd for our summary calculation the accumulated results will be 0.