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

Creating a sum of a running total?

Status
Not open for further replies.

discskyer

Technical User
Nov 18, 2005
14
US
Is this possible or can I go about it some other way?

Here is my situation...
I have a running total of a field called @AmountApplied. That runnnigtotal is being subtracted from an invoice amount so that we can display an actual balance per transaction. At the end of that section, I need to display the end amount as the total remaining balance on that invoice. After that, I need to total up all of the remaining balances to form a grand total. Any help in getting that set up would be highly appreciated. Thanks!

AW
 
You should provide information about your report structure in your posts, e.g., groups, etc. Ordinarily, it is also a good idea to provide the contents of any formulas used. But let me guess that you have one invoice amount with multiple payments against it, and that you have a group on invoice. The detail section would show the same invoice amount repeatedly, and the formula that subtracts the running total of the amount applied would look like:

{table.invamt} - {#amtapplied}

If the running total is an inserted one, I think you could drag this formula (let's call it {@bal}) into the group footer and get the correct result. You could then accumulate the formula across multiple invoices by using a variable:

//{@accum} to be placed in the invoice group footer:
whileprintingrecords;
currencyvar sumbal := sumbal + {@bal};

//{@displ} to be placed in the report footer:
whileprintingrecords;
currencyvar sumbal;

If {@bal} is a number, not a currency, change the variable type to "numbervar" instead of "currencyvar" in the formulas above.

-LB
 
Thanks for the help LB. I ended up working it a slightly different way. With those values, I ended up tweaking the formula used to derive the sum and used that in my calculations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top