Counting the Number of Groups in a Report
- 2 minutes to read
This document describes how to count the number of groups in a report.
Note
You can use this approach to counting groups when the UserDesignerOptions.DataBindingMode is set to DataBindingMode.Expressions or DataBindingMode.ExpressionsAdvanced.
See Counting the Number of Groups in a Report to learn about the legacy approach to solving this task.
See Data Binding Modes to learn more about the available binding modes.
A report can display the total number of groups after binding your report to data and providing content to the report’s detail band.
First, group the report’s data. Switch to the Group and Sort panel and create a new group. Enable the Show Header option to display the group header in the report.
Switch to the Field List and drop the group field onto the created group header.
Right-click the report’s surface and add a report footer to the report.
Drop a label onto the report footer and invoke its smart tag. Set its Summary Running property to Report.
Click the ellipsis button for the label’s Expression property.
This invokes the Summary Expression Editor where you can specify the required summary function.
You can use the FormatString property to format the summary’s value:
You can see the group count in the report footer when switching to Print Preview: