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

Group total adding last record value again before display. 1

Status
Not open for further replies.

baberk

MIS
Jan 14, 2009
3
US
I am using CR XI and trying to display a total in the GP2 group footer, but it is adding the last record's value again before it displays.

GP 1 - ChargeDate (Month)
GP 2 - ChargeDate (Day)
GP 3 - Charge
GP 4 - Charge Modifier

//Charge total formula
whileprintingrecords;
shared numbervar Total_Chg_Per_Code;
Total_Chg_Per_Code := QTY * Fee;

//Daily total formula
WhilePrintingRecords;
EvaluateAfter ({@Total Chg per Code});
shared numbervar Total_Chg_Per_Day;
shared numbervar Total_Chg_Per_Code;
Total_Chg_Per_Day := Total_Chg_Per_Day + Total_Chg_Per_Code;

Both formulas are in the details section, and the total is correct until I try to display it in the GP2 footer section. Then, for example, if the last charge amount is 400, it adds 400 to the total again and displays that amount.

//Display formula in GP2 footer
whileprintingrecords;
shared numbervar Total_Chg_Per_Day;

I have Total_Chg_Per_Day reset in GP2 header and Total_Chg_Per_Code reset in GP4 header. Any help is appreciated because I have looked at this a while now and can't figure out why this is happening. Thanks in advance!!
 
PLace your formula

//Display formula in GP2 footer
whileprintingrecords;
shared numbervar Total_Chg_Per_Day;

In details and GFooters 4, 3 and 2 and see where it changes

Ian
 
It is correct in GFooters 4 and 3, GFooter 2 is where it changes.
 
Are you sure you have not got the Variable evaluating again somewhere in the GF2?

Because from what you are saying that is all that can cause it to increment, please check all formula in GF2.

Ian
 
That was it! I had a percentage formula after my display formula in GF2 that was causing it to evaluate again, and had not checked that formula. Thanks so much for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top