Calculate a Summary
- 2 minutes to read
This tutorial demonstrates how to obtain a total price within each detail report by calculating a summary for a data-bound label control using a built-in function.
Do the following to accomplish this task:
Select the detail report and add a Group Footer by switching to the Properties panel and clicking the Insert Group Footer Band button in the Actions category. This allows you to display a summary at the bottom of each detail report
Ensure that the Group Footer band is correctly associated with an appropriate Group Header band using the Level property. For this tutorial, the Group Footer’s Level property should be set to 1 (as specified in the previous tutorial).
Drop the Label control from the Toolbox onto the created Group Footer.
Select the newly created label and expand the Actions category in the Properties panel. In the Summary section, set the Running property to a value that specifies the range for which to calculate a summary (the entire report, a specific report group or document page). Then, click the Expression property’s ellipsis button, and in the invoked Expression Editor, select the required summary in the Functions | Summary section.
The Format String property allows you to apply formatting to the summary result. For instance, use the Total: {0:c2} string to format a summary value as a currency and add a custom text before this value.
You can also use the Ignore NULL values option to specify whether to consider null (empty) data source records when calculating the total. This property is aimed at functions like sumCount or sumAverage because the number of elements counted depends on the property value.
Specify the summary label’s appearance settings (for instance, make the font bold). Use the Line controls to separate the field captions and summary value from the detail data.
Click the Preview toolbar button to view the result.