To count the number of records in a report or a group, follow the instructions below.
-
Create a new reportor open an existing one.
-
Add a Report Footerband to a report. To do this, right-click anywhere over the report's area and in the invoked Context Menu, point to Insert Bandand select ReportFooter.
-
In the same manner, add GroupHeaderand GroupFooterbands to the report.
-
Drop the required data fields from the Field Listonto the report bands.
-
Click the field for which the number of records will be calculated, to select it. Then, hold down CTRL and drag the field onto the Group Footer area, to create an exact copy of the Label, which will display the number of records for a group.
-
In the same way, create a copy of this field in the Report Footer area, to display the number of records for the report.
-
Click the Smart Tagof the GroupHeader1band, and in the invoked actions list, click the ellipsis button in the Group Fieldssection. The GroupField Collection Editordialog will appear.
In this dialog, click Add, to add a new grouping field, and set its FieldNameproperty to the required field.
To apply the settings and close the dialog, click OK.
-
Select the Label in the Group Footer area, and in the Property Grid, expand the Summaryproperty.
Set the Runningproperty to Group, Functionto Countand (if required) Ignore Null Valuesto Yes. Also, set the Format Stringproperty to Products in the Group: {0}.
-
Similarly, select the Label in the Report Footer area, and in the Property Grid, expand the Summaryproperty.
Set the Runningproperty to Report, Functionto Count, Ignore Null Valuesto Yesand Format Stringto Products in the Report: {0}.
The report is now ready. Switch to the Preview Tab, and view the result.
See Also