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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Total from Shared Variable

Status
Not open for further replies.

CappsRLO

Vendor
Apr 18, 2007
31
US
I have a subreport in GH3 which contains a CurrencyVar @TotalCost that SUMs a specific field and is brought to the Main Report GF3 showing totals for the Records in that Group.
Now I need to show a Grand Total for all the Records but if I put that same CurrencyVar in the Report Footer it only gives me the total for the last record set, not all of them.
 
In the main report, create a formula like this and place it in the GF3:

whileprintingrecords;
shared currencyvar x; //replace x with your shared variable name
currencyvar y := y + x;

Then in the report footer use:
whileprintingrecords;
currencyvar y;

-LB
 
I created the formula as requested:
WhilePrintingRecords;
Shared CurrencyVar SubTotalCostTotalMain; //pulls from subreport
CurrencyVar GT:= GT + SubTotalCostTotalMain; //creats new GT Variable for RF grand totals

When viewed in GF3 it doubles the amounts and does a running total for each record group. I need each record group to show it's own totals but still grand total at the end of the report
 
sry, nevermind, I found my extra field causing this to double the amounts.
I also found out that I need to Suppress your formula in GF3 but leave my original formula for the Shared Variable showing the totals for each record group
 
You could use this in GF3 instead of two different formulas:

whileprintingrecords;
shared currencyvar x; //replace x with your shared variable name
currencyvar y := y + x;
x

The last line (x) will be what is displayed. You still need a separate display formula for the report footer.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top