Calculate Custom Summaries via Scripts
This document describes how to evaluate custom summaries using report scripts within the End-User Report Designer.
Create a new XRLabel, which is the only report control that supports custom summary calculations.
The value range encompassed by the summary function within a report implies an appropriate band to display the result. For example, the Group Header or Group Footer bands are most appropriate to display the result of a summary that is calculated within a group.
The label must be bound to any field that belongs to a data table involved in the script's calculations.
Specify the value range within a report that is encompassed by the summary function and set the XRSummary.Running property of the object returned by the XRLabel.Summary property.
Set the XRSummary.Func property to SummaryFunc.Custom and assign custom scripts to the appropriate event handlers of the object returned by the XRLabel.Scripts property.
The following event handlers are available.
- XRLabelScripts.OnSummaryReset - Handle it to restore a current summary result to its default value (e.g., before traversing each group entry).
- XRLabelScripts.OnSummaryRowChanged - Handle it to retrieve the current row from the report's data source (e.g., before obtaining the current detail band record).
- XRLabelScripts.OnSummaryGetResult - Handle it to obtain the final summary result (e.g., before displaying it in a report). To complete a summary calculation, enable the Handled parameter.