Calculating Summaries
This topic describes a way of calculating a summary for a data-bound label based on one of the built-in functions.
Calculating an Automatic Summary
For a data-bound Label control, Advanced Reports supports automatic calculation of various summary functions across a data field from where the label obtains its content. The functions include total, maximum, minimum, average, count and many others. The complete list of functions available is returned by the Summary | Function.
A summary value can only be correctly calculated if a label is bound to data of numeric type. For String values, it is only possible to auto-calculate the following functions: Count, DCount and Record Number.
To calculate an automatic summary for a label do the following:
- Bind a label to the data to be summarised. A summary is calculated only if data is bound to the Text property of a label.
- Expand the Summary property to view all the options provided by the Summary object.
Or click the ellipsis button (...) of this property to adjust all settings using the Summary Editor.
- First, you should specify the actual function which is to be calculated via the Function property. It is set to Sum (plain summary) by default.
- Specify the range within which data should be summarized via the Running property. An automatic summary can be calculated for values within a group, a page or the entire report.
The diagram below represents the end of the created report and shows the calculated total for all of the drillholes.
The summary label should be placed onto a band that corresponds to the specified summary range. For example, if a summary is to run through page, the summary label should be placed onto PageHeaderBand or / and PageFooterBand. Alternatively, if a summary is being calculated for a group, then the summary label should be placed onto the corresponding GroupHeaderBand or GroupFooterBand.
In order to calculate a summary it is critical that another label be placed in the report's Detail band, which is bound to the same data field that is to be summarised by the summary label. The label in the Detail band comprises a report's general data and if empty, the summary becomes empty as well with no regard as to which range is specified for it and onto which band it is placed.