In a section report, you can set grouping on a field or a field expression. Use the following steps to understand grouping in a section report.
These steps assume that you have already added a Section Report (xml-based) or Section Report (code based) template and connected it to a data source. See Adding an ActiveReport to a Project for further information.
To set grouping in a Section Report
- Right-click the design surface of a report and select Insert, then Group Header/Footer. Group Header and Footer sections appear immediately above and below the detail section.
- With the GroupHeader section selected, go to the Properties window and set the DataField to a field on which you want to group the data. For example, Country from Customers table in the NWind database.
Note: You can also set a field expression in the DataField property. For example, =Country + City
. - Drag and drop the grouping field onto the GroupHeader section to see the grouping field while previewing the report.
- Drag and drop data fields onto the detail section. All the data placed inside the detail section gets grouped according to grouping field.
- Preview the report to see the result.
The following image shows a customer list grouped on the Country field.
Tip: In a section report, data is grouped in the order in which it is fetched in the raw form. Therefore, for best results, while setting the SQL query in your report data source, order the data by the grouping field. For example., SELECT * FROM Customers ORDER BY Country |
Concepts
Grouping Data (Section Layout)