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!

Row by Row Calculations

Status
Not open for further replies.

macktruck

Programmer
Sep 17, 2010
22
KE

Dear Experts,

I have an interesting problem here.

I have a two values on a row. Say value A = 5000 and Value B = 20000. Value A changes from row to row but Value B is constant. I would like to deduct Value A from B such that Value B keeps decreasing cummulatively with each row. Such as on Row 1 the Variance would be 15,000 from 20000-5000

On Row 2 where Value A is 3000, I would like to have the variance as 15000 - 3000 = 12000 and so on. How can I achieve this programmatically ? I should then do a running total on the variances.
 
You must use a variable.

In report or group header
@reset
whileprintingrecords;

global numbervar B:={Bfield}


In Details

@eval
whileprintingrecords;

global numbervar B;

B:= B-{fieldA]

If you want to show B in a footer

@display
whileprintingrecords;

global numbervar B;


Ian



 
I think you could insert a running total that sums fieldA. Then you could use a formula for the balance:

{table.fieldB}-{#runningtotalfieldA}

If you want this reset per some group, add a reset to the running total on change of group.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top