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

Manual Running Total Formulas Aren't Working

Status
Not open for further replies.

lkiningh

Technical User
Feb 23, 2011
9
US
I have 3 formulas to create a running total.

//@Initialize
WhilePrintingRecords;
NumberVar RunningTotal1;
Runningtotal1 := 0;

//@Evaluate
evaluateafter({RECEIPT_MASTER.PAYMENT_AMT});
NumberVar RunningTotal1;
if onfirstrecord and {@CompareDates} = "1" then
RunningTotal1 :={RECEIPT_MASTER.PAYMENT_AMT}
else if
{RECEIPT_MASTER.RECEIPT_NUM} <> previous ({RECEIPT_MASTER.RECEIPT_NUM}) and
{@CompareDates} = "1" then
RunningTotal1 := RunningTotal1 + {RECEIPT_MASTER.PAYMENT_AMT}

//@Display
EvaluateAfter ({RECEIPT_MASTER.RECEIPT_NUM});
WhilePrintingRecords;
NumberVar RunningTotal1;
RunningTotal1;

I have used these formulas in many reports but for some reason in this particular report it is not working correctly. The problems are sporadic and changing.

1. The first problem is that the total is resetting back to zero in the middle of the report for no apparent reason.

2. The next problem is that the total will display "0".

The 2 problems do not always happen. Sometimes the report will run perfectly. Sometimes it will run and have issue 1 and sometimes it will have issue 2. I don't know where to begin since there seems to be no consistency to what is going on. Any ideas?
 
Please show the content of {@CompareDates} and also identify the sections where the formulas are located. Also explain why you are using evaluateafter--I don't think it is doing anything in this case.

If you have the reset formula in a group header that repeats, you should change the formula to:

WhilePrintingRecords;
NumberVar RunningTotal1;
if not inrepeatedgroupheader then
Runningtotal1 := 0;

-LB
 
//@CompareDates
If {RECEIPT_MASTER.RECEIPT_DATE} >= {@MinDate} then '1'
else '0';

(@MinDate - Gets the minimum date from another date field that I need to compare to the receipt date field.)

@Initialize is in the report header
@Evaluate is in the group header
@Display is in the report footer

I tried using evaluateafter to reconcile the problem. And I thought it corrected it until I ran the report the 4th time.


 
But what field are you grouping on? Please also show the actual content of {@mindate}.

-LB
 
I believe I just found the problem. I am suppressing rows based on the outcome of @CompareDates. The running total formula was still looking at that suppressed data. I created another formula for the PAYMENT_AMOUNT using the @CompareDates and that seems to have corrected the problem. I have run the report multiple times and with varying parameters - all with success.

LBASS - Thank you for your time!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top