Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 577
  • Last Modified:

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
0
nemesis1210
Asked:
nemesis1210
  • 5
  • 4
1 Solution
 
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
 
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
RPCITCommented:
try adding whileprintingrecords; at the top of the display formula
0
 
nemesis1210Author Commented:
Perfect thank you
0
 
nemesis1210Author Commented:
Worked like a champ
0
 
RPCITCommented:
You welcome :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now