The requested page is not available for the requested platform. You are viewing the content for Default platform.

Count the Number of Records in a Report or Group

This tutorial describes how to calculate the total number of records in a report or a group.

Note

This approach to calculating the number of data records applies when the UserDesignerOptions.DataBindingMode is set to DataBindingMode.Bindings.

See Count the Number of Records in a Report or Group to learn about the alternative approach to solving this task.

See Data Binding Modes to learn more about the available binding modes.

The following image illustrates the report created in this tutorial:

HowTo - CountNumberOfRecords_5

Do the following to calculate the total number of records in a report or a group:

  1. To count the number of records in both a report and each group, use the report created in the following tutorial: Group and Sort a Report's Data.
  2. To display the number of records in the report, add the ReportFooter. To do this, right-click anywhere in the report designer, and in the context menu point to Insert Band, and then click ReportFooter.

    Shared_BandsAddReportFooter

    Then, add the GroupFooter to display the number of records in each group.

  3. Select the label that resides in the Detail band, hold down CTRL, and drag the label's copy to the Group Footer. It will serve as a summary field.

    HowTo_CountNumberOfRecords_1

    Similarly, place a copy of this label on the Report Footer.

  4. Select the label in the Group Footer and click its smart tag. In the invoked actions list, set the Summary Running property (XRSummary.Running) to Group to calculate the summary for each group in the report.

    Set the Summary Func (XRSummary.Func) to Count and define a format string (XRControl.TextFormatString).

    HowTo - CountNumberOfRecords_3

  5. Do the same for the label placed in the Report Footer, but set its XRSummary.Running property to Report.