Link to home
Start Free TrialLog in
Avatar of nemesis1210
nemesis1210

asked on

Crystal Reports Running Total in a Formula

Looking to find out how to write a formula that will calculate the running total of a field and reset on change of a group
Avatar of RPCIT
RPCIT

You shouldn't actually have to use a formula unless you want to get fancy. (which sometimes happens)

You can use a RunningTotalField (should show up in your fields list, right click and hit new) .

The running total field allows you to change when you want to evaluate, and when you want to reset.
Avatar of nemesis1210

ASKER

unfortunatly I need to get fancy, I need to be able to run a calculation on two existing running totals and am unable to do so, so I am hoping to be able to create formulas for these as opposed to running total fields so I can perform my calculation.

Thanks anyhow
You can manually create runnign totals, or "fancy" formulas by adding formula fields to the sections you want..

you could put the reset field in the group header, the increment field in the detail, and the display in the footer.

using something like this in the code:

//begin increase value;
WhilePrintingRecords;
numberVar SomeVal;
SomeVal := SomeVal + {tablName.FieldName}
//end
 
//begin reset value;
WhilePrintingRecords;
numberVar SomeVal;
SomeVal := 0;
//end
 
//begin display value;
numberVar SomeVal;
SomeVal
//end

Open in new window

missing semi-colon (;) on line 4
almost there, values increase during the detail and reset at each group, however display is always zero in the footer
ASKER CERTIFIED SOLUTION
Avatar of RPCIT
RPCIT

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect thank you
Worked like a champ
You welcome :)