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

help writing running total function

Status
Not open for further replies.

prettitoni

Programmer
Apr 22, 2004
74
US
I have a report set up like this and I need to write a function that calculates a running total to get the Net values (from a starting value which is supplied).

Say the starting value is 20, the results should go:

Code:
Field1   Field2    Add    Sub    Net
-------------------------------------
12         A+       10            30
13         A               5      25 
11         C        12            37 
01         D               10     27
12         B        11            38

Can someone please help me write this function in CR8?
I kind of started with this. I know I have to loop through the records somehow and I don't know how to do it in CR.

HoldVal := StartingValue;
HoldVal := HoldVal + (Sub - Add)
 
How do you know the starting value?

Anyway, just create a formula containing:

{table.Add}-{table.sub}

Now use that formula in a Running Total and drop the Running Total in the Details section.

You can also use the formula you created, but again, how do you learn the starting value?

HoldVal := StartingValue;
HoldVal := HoldVal + (Sub - Add)

-k
 
I pass in the starting value from a VB application. I'm using an ODBC connection to the report and when I open the recordset, I send in the starting value...

Using the formula I created, I did a running total on that but its giving me some huge numbers that aren't correct.

 
I set up the running total to get the Sum of that formula...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top