grand total values at the heading

mjdarm

Member
Would like to know wheter is it possible to display the grand total values in the first line of the report which are accumulated during the report generation?

Scenario,
Iam generating a sales report for a month which will be displayed customerwise or itemwise. If i need to know the total sales, i will have to go the end of the report. Instead, i need those grand total to be displayed at the first line of the report while the other details can continue.

Iam using accumulate function to sum up the values at various levels.

One option is to have a seperate loop to find the total values and assign to a local variable and display it as a seperate form header and then begin one more loop to continue the usual way.
This would be time consuming activity as this will need to loop thru the same tables twice.
Would appreciate if i get a shortcut way to do the same.
 
Method 1:

Instead of directly outputting the details accumulate them in a temp-table (or if you're using a sufficiently modern version of Progress use a ProDataSet). Then use the temp-table to write the report details. You'll make one pass through the database and the second pass, to output the report, will be through the temp-table. Obviously you would take advantage of the situation to only put the needed fields in the temp table, to properly pre-format data and do lookups and joins on the data as well as to calculate the totals that you need.

Method 2:

Output place holders for the totals in the report. Then run a merge program that replaces the place holders with the actual data. On UNIX I would probably just run a "sed" script. For Windows I would first apply the Linux patch and then run sed :)
 
Back
Top