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
LVL 2
nemesis1210Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
RPCITConnect With a Mentor Commented:
try adding whileprintingrecords; at the top of the display formula
0
 
RPCITCommented:
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.
0
 
nemesis1210Author Commented:
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
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
RPCITCommented:
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

0
 
RPCITCommented:
missing semi-colon (;) on line 4
0
 
nemesis1210Author Commented:
almost there, values increase during the detail and reset at each group, however display is always zero in the footer
0
 
nemesis1210Author Commented:
Perfect thank you
0
 
nemesis1210Author Commented:
Worked like a champ
0
 
RPCITCommented:
You welcome :)
0
All Courses

From novice to tech pro — start learning today.