Creating Running Totals
The best method available to you to learn how to do this is to look over our Running Total Whitepaper. It gives lots of examples and explains in full detail the methods that you will need to use to create the running totals in your report. To get our running total whitepaper, please download it from our website at the following link:
http://support.crystaldecisions.com/library/
Once there, please do a search and download the following documents:
scr_variablescopes.pdf
scr_running_total.zip
With Crystal Reports you cannot create a summary field base on a formula with a summary field. What you will need to do is use-running totals. There are three formulas you are to create. One is to reset the variable you are going to create to contain the total of your running total. One is to do the actual calculation and the last one is to display the running total.
The Reset Formula:
The following formula is to be place in your group header so it will reset the variable on the change of each new group. X is the name of the variable
Whileprintingrecords;
Numbervar X := 0
The Calculation Formula:
Place this formula in the detail section.
Whileprintingrecords;
Numbervar X:=X +{fieldnametoaddup}
***For duplicate records the formula would look like this***
Whileprintingrecords;
If onfirstrecord or previous({fieldname})<>{fieldname} then
Numbervar X:= X + 1
***For Conditionally Suppressed Records***
You will have to include the suppression condition in the formula for example:
Lets say you have record #51 suppressed then the formula should look like this:
If {fieldname} <> 51 then numbervar X:=X+1
This means the running total will only add one for every record as long as it is not 51.
The Display Formula
Place this formula in the group footer to display the result
Whileprintingrecords;
Numbervar X;
Original Article at : http://www.crystalconsulting.ca/faq.html#running
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment