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

Cannot sum a formular in a group footer 1

Status
Not open for further replies.

awinter

Technical User
Nov 6, 2001
15
GB
I have a report that is grouped by customer and then part number. So only parts sold between 2 dates are shown for a given customer.

The detail section is suppressed for both G1 & G2 and also the G2 header is suppressed. The G2 footer has a sum of parts sold between 2 dates for each part.

I have used this formular to add a running total to the G2 footer and this works great,

whileprintingrecords;
numbervar grandtotal := grandtotal + {@forDirectcosts}

direct costs being

Shared numbervar directcosts:=
({RELACK.SELBSTKOSTEN}*Sum ({RELFBR.SEGM6_MENG}, {RELFBR.MNR}))/1000

What I want to be able to is put a simalar formular in the G1 footer to give the the sub total for each customer.
I have tried the reset formular,

shared numbervar directcosts :=0;

In the G1 header and the,
whileprintingrecords;
numbervar grandtotal := grandtotal + {@forDirectcosts}

in the G1 footer but this does not work correctly, it seems to add the last G2 footer value up for each customer as a running total.

Any help would be appreciated.

Regards
Allan
 
Are you using a subreport in your report? You didn't mention one, but that is the only reason to use a "shared" variable. Anyway, you need to name your group 1 variable something else, e.g., "grp1sum". Create a reset formula:

//{@reset} to be placed in GH#1:
whileprintingrecords;
numbervar grp1sum := 0;

Then change your accumulation formula to:

whileprintingrecords;
numbervar grandtotal := grandtotal + {@forDirectcosts};
numbervar grp1sum := grp1sum + {@forDirectcosts};

Place this in the GF#2.

Then create another formula:

//{@displgrp1sum} to be placed in the GF#1:
whileprintingrecords;
numbervar grp1sum;

You would use the following in your report footer:

whileprintingrecords;
numbervar grandtotal;

Be sure to remove your earlier attempts at this before adding these formulas, since multiple accumulation formulas in one section will change the calculations.

-LB
 
Excellent, this now works!!

Thankyou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top