Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Totals in Group Footers

Status
Not open for further replies.
Aug 28, 2003
18
CA
I have a question regarding group totals. Is it possible to add a field in the group totals section that shows the grand total from the end of the report?

I am trying to generate a group footer that shows the group's total and also want to show the report's total so that I can show the difference between the two at the end of every group.

Any help is much appreciated.
 
Depending on how you are calculating your report total, you may or may not be able to do it.

If your gand total is a summary, not a Running Total or formulas with variables, then you can do it.

How are you calculating the GT?

~Brian
 
I have needed this in the past in CR ver 9 reports. Here is one approach using Shared variables if your CR version and environment permits.
Initialize a Shared variable(s) in the Main report header, subsection a. Create a subreport in Main Report header subsection b to force it to run after initializing the Shared variable, but before the balance of your report.

Suppress all the sections in the Subreport to hide it and select the same data in that subreport as the Main report. Determine the report total(s) you need and assign them to the Shared variable(s):

MAIN-RHa
I_A
WhilePrintingRecords;
Shared NumberVar Array A := [O, 0, 0]

Subreport
S_A in the details section
WhilePrintingRecords;
Shared NumberVar Array A;
ReDim Preserve A[3];
A[1] := A[1] + {database_field}

Main-G1F
P_A
WhilePrintingRecords;
Shared NumberVar Array A;
ReDim Preserve A[3];
A[1]

Shared variable A[1] will now contain the sum of the field values for all records in all group levels in the report and can be printed, or used in the formulas, in the Group 1 Footer. The ReDim Preserve stmts seemed to be neccessary in my reports to prevent dimensioning errors as the Shared variables are passed yet preserving the values already in the array. All avoided of course if you dont use or need arrays. Hope this helps, have a great day.
 
I got it now.

I created a Summary in the report footer and then created a formula to read from this total.

Thanks for the tip.
 
Okay, but be careful. The Summary may "overcount" if the field value you are summarizing appears on multiple records. Also, I understood you needed the Report Total as the report was printing/processing the detail records for each group. In my case, the Summary in the RF was not available as the details were processing/printing from the RF summary and I needed to condition the running total. Just a couple of thoughts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top