[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# Crystal Reports Running Total in a Formula

Posted on 2009-03-30
Medium Priority
565 Views
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
Question by:nemesis1210
• 5
• 4

LVL 6

Expert Comment

ID: 24022392
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

LVL 2

Author Comment

ID: 24022613
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

LVL 6

Expert Comment

ID: 24022757
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
``````
0

LVL 6

Expert Comment

ID: 24022768
missing semi-colon (;) on line 4
0

LVL 2

Author Comment

ID: 24022952
almost there, values increase during the detail and reset at each group, however display is always zero in the footer
0

LVL 6

Accepted Solution

RPCIT earned 2000 total points
ID: 24022958
try adding whileprintingrecords; at the top of the display formula
0

LVL 2

Author Comment

ID: 24023085
Perfect thank you
0

LVL 2

Author Closing Comment

ID: 31564497
Worked like a champ
0

LVL 6

Expert Comment

ID: 24023842
You welcome :)
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
###### Suggested Courses
Course of the Month18 days, 3 hours left to enroll

#### 830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.