Info

Figure 3-20

Figure 3-20

The first thing you need to do is type a name for your running total in the Running Total Name box. It can be any name you like, as long as it makes sense to you. Crystal Reports will put the pound symbol (#) in front of your running total name so you can easily identify this field as a running total when it is inserted into your report.

The next step in creating a running total is to select a field to summarize and then choose a summary option. To select a field, locate it in the list on the left and then click the top right arrow to move the field to the textbox on the right. From the pull-down box immediately below the summary field, you need to select a summary operator. All of your old favorites are here: Sum, Average, and so on. And because in this example you are inserting a running total that will run down the page, you don't need to worry about the Evaluate and Reset options for the running total. Click OK to accept your changes and return to your report design. You'll notice that your running total field has been inserted into your report in the Details section.

As you created your first running total field, you may have noticed two sections in the Create Running Total Field dialog marked Evaluate and Reset. These sections are for setting the options related to when your running total will be evaluated and when the total will be reset. For evaluation times, you can select a calculation time for your running total from the following options:

For example, you would want to use these options if you were creating a running total to sum all of the international sales in a report. You could select the Use a Formula option and enter this criteria:

The resulting running total field would be evaluated only for those customers who are not in the United States.

Likewise, you can reset your running total field using the following options:

For example, you could reset the running total for each change of the country field within your list. By using the evaluation and reset options, you can create running total fields for just about any use you can imagine.

To use these options, in most cases you will need to select the option and the corresponding field or group. For the Use a Formula option, you will need to select the option and then click the X+2 button to open the Crystal Reports formula editor and enter your criteria. As with record selection, the formula you create here needs to return a Boolean value — either true or false. If the value is true, the record will be evaluated or the running total reset (depending on the option you are working with); likewise, if the condition evaluates to false, the action will not take place.

For more information on working with formulas, check out Chapter 8, "Formulas and Logic."

Was this article helpful?

0 0

Post a comment