Script to Print a Group Sum in the Group Header
Previous Topic  Next Topic 

Printing the group sum in the header requires the use of scripts because the value of a group sum is only known after all the records in the group have been processed. To display the sum in the group header (that is, before the group is output to the report) the following algorithm is used:


  1. Turn on the two-pass report option (Report | Options)
  2. In the first pass, calculate the sums for each group and save them in an array
  3. In the second pass, extract the values from the array and display them in the group headers


To see how this is accomplished, edit or copy the Resource Bottleneck Report.  The scripts in this report totals two variables for printing on the group header.  The script is commented for learning purposes.