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!

Running Total variables

Status
Not open for further replies.

terrym777

Technical User
Jun 14, 2010
31
US
I am using formulas for my data as in some cases I need to make the value zero if it has been brought in twice. As such, I am using running total variables and not the RT function. The question I have is why the last value in a group is being added into my group total line?

Here is my example:

PH Net Core Net Core Group Totals Net Core Report Totals
GH @NetCoreGrpReset
D @NetCore @NetCoreGrpTot @NetCoreRptTot
GF @NetCoreGrpTot @NetCoreGrpTot @NetCoreRptTot
RF @NetCoreRptTot @NetCoreRptTot


D $1000 $1000 $1000
D 0 1000 1000
D 500 1500 1500
GF $2000 $2000 $2000
D 700 700 2700
D 300 1000 3000
GF $1300 $1300 $3300

My group total line is off by the last amount of $500 in the detail line. It is being added in again. In this example, I want to see $1500.00 on the group detail line. I’m using the Group Total column and the Report Total column only for testing and they will ultimately be suppressed in the report. The group reset is working fine and you can see that the running total for the whole report is working fine except for adding the last detail amount for each group.


@NetCore
If OnFirstRecord Then {CHILD_TUITION.NET_CORE_TUITION} Else
If { CHILD_TUITION.TM_ID} = Previous({CHILD_TUITION.TM_ID})
Then 0 Else { CHILD_TUITION.NET_CORE_TUITION}

@NetCoreGrpTot
WhilePrintingRecords;
CurrencyVar GrpNetCore := GrpNetCore + {@NetCore}

@NetCoreRptTot
WhilePrintingRecords;
CurrencyVar RptNetCore := RptNetCore + {@NetCore}

@NetCoreGrpReset
WhilePrintingRecords;
CurrencyVar GrpNetCore := 0;

 
Its becuse when you show RptTot in report footer you are evaluating it again with last record.

Remove NetCoreRptTot from report Footer, but leave it in its evaluation position, create a new formula

@NetCoreRptTotDisplay
WhilePrintingRecords;
CurrencyVar RptNetCore;

You will probably have to do same with Group Total too

Ian
 
Hi Ian,

I thought I tried that and it still did not work but I will try it again. Do I place these new Display formulas on the GH and RF lines?

Thanks for your help,
Terry
 
Hi again,

It looked like it worked this time.

Thanks!
 
They have to go in Footers. Headers are printed before the vars can be evaluated.
Resets for group go in the Group header

That is why you must use the Whileprinting; function

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top