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

How to Reset Running Total Conditionally? 1

Status
Not open for further replies.

zeekay

Programmer
Nov 15, 2009
18
GB
Hi All,

I have a monthly stock and sales projection report in crystal. I am using running total on stock's column. I want to reset the running total if it goes negative. It should start from the row again where it becomes positive.

Any help in this regard will be highly appreciated.

Thanks
 
It is not clear whether you mean to ignore negative values and continue with the current running total or whether you want the running total to begin with zero again.

-LB
 
Hi, I want running total to start with zero again.
Thanks.
Zeekay
 
Instead of using an inserted running total, use the following formula for the running total:

whileprintingrecords;
numbervar sumamt;
if sumamt + {table.stock} < 0 then
sumamt := 0 else
sumamt := sumamt + {table.stock};

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top