This subsection describes creating a summary field and inserting it into your report.
To display the Add Summary Field dialog
Click the Summary tab of the Catalog of Available Fields dialog. The Summary sheet is then displayed.
Click the New button on the Catalog of Available Fields dialog toolbar.
The Add Summary Field dialog is then displayed, as shown in the following image.
To build the summary field
In the Name text box, enter the name that you require for your summary. The name must start with a lowercase letter and can contain spaces. The summary field name can be up to 30 characters long. The example name (grand total) in the previous image is a grand total that is printed at the end of the report.
In the Summary Function list box, select the type of function that you want to perform. The following table describes the available summary functions.
Summary Function | Provides … |
---|---|
Count | A total of the number of occurrences of the target field |
Distinct Count | A count of the unique values of the target field |
Non-null Count | A count of all non-null items of the target field |
Max | The maximum value of the target field |
Min | The minimum value of the target field |
Sum | A total of the target field |
Average | The average value of the target field |
Non-zero Average | The average value of all non-zero items of the target field |
The Sum, Average, and Non-zero Average functions are displayed only for numeric fields. In the example in the previous image, the Sum function is selected.
Check the Running Total check box if you want to print the field as a running total periodically during the report, rather than one final total at the end of a group or at the end of the report. By default, this check box is not checked, indicating that only an end of group or report total is required.
In the Summary Field list box, select the field to which you want to apply the summary function, as shown in the following image.
In this example, the sale item price has been selected from the available database fields, to accumulate the total sales for the report.
Note that Clients is an alias for the allClients feature. The price feature is qualified as RetailSaleItem.price, since RetailSaleItem is the subclass of SaleItem used in the report.
In the Reset group box in the lower part of the dialog, select how and when you want your summary field reset. For example, you would want the total to be reset every time the group changes if you want to accumulate a total by group.
Select one of the Reset option buttons, as follows.
Select the Never option button if you never want your summary field reset during the running of the report.
Typically, select this option if you want to accumulate a grand total.
Select the When Database Field Changes option button if you want your summary field reset each time a selected database field changes.
In the list box below the When Database Field Changes option button, select the database field that determines when your summary field is reset. For example, you could create totals for each client by selecting the client name field, as shown in the following image.
In this example, your summary field is reset each time the client name changes.
Select the When Group Changes option button if you want your summary field reset each time a report group changes.
In the list box below the When Group Changes option button, select the group field that determines when your summary field is reset, as shown in the following image.
In this example, Group #1 (Customer) is selected and the summary field is reset each time the group changes. For details about creating groups, see "Creating Groups", earlier in this chapter.
Select the After Printing option button if you want your summary field to be reset only after printing.
This option is in contrast to the Never option, in which your summary field is not reset between print runs during the same JADE Report Writer Designer session.
Click the Apply button to create the summary field.
Click the Close button.
The Add Summary Field dialog is then closed and the new summary field is added to the list on the Summary sheet of the Catalog of Available Fields dialog, as shown in the following image.
In this example, grand total is a report total; that is, the reset option is Never. It is a summary of all prices of the sale items printed in the report.
When you have created your summary field, you can then insert it into your report.
To insert your summary field into your report
For details about inserting fields into your layout, see "Inserting Report Fields", earlier in this chapter.