ActiveReports 11
Grouping Data in Section Reports
ActiveReports 11 > ActiveReports User Guide > Concepts > Section Report Concepts > Grouping Data in Section Reports

In a section report, you can group data by adding a pair of group header and group footer sections to the report. These sections appear immediately above and below the detail section. See Add Grouping in Section Reports for further information on how to group data.

Caution: You cannot add a header section without a corresponding footer section. If you try to do so in code, the results are unstable.

You can set the properties for the GroupHeader and GroupFooter sections in their corresponding dialogs. Following is a list of properties you can set through the options in these dialogs. Each option in the GroupHeader dialog corresponds to a property in the properties window. To access the properties directly, select the section and open the properties window. See the associated property names in parenthesis with each dialog option below.

GroupHeader Dialog

To access the GroupHeader dialog, right click the group header and in the Properties window under the properties list where the commands are displayed, click the Property dialog link. See Properties Window for further information on commands.

General

Appearance

Layout

GroupFooter Dialog

To access the GroupFooter dialog, right click the group footer and in the Properties window under the properties list where the commands are displayed, click the Property dialog link. See Properties Window for further information on commands.

General

Appearance

Layout

When you run the report, it renders the group header, followed by all related instances of the detail section, and then the group footer. It renders a new group header section for each instance of the grouping field.

Controls in the group header render once for each instance of the group, so you can place the column header labels to describe the data in the detail fields here.

Multiple Grouping

In a section report, you can nest group header and footer pairs and group each on a different field. You can add up to 32 groupings in one report.

Note: As with any group header and footer pair, group your data on the fields that you specify in the DataField property of the group header, but in the order of your groups. For example: SELECT * FROM Customers ORDER BY GroupHeader1DataField, GroupHeader2DataField, GroupHeader3DataField

See the image below for the order in which report sections appear on the report. GroupHeader1 in the image was added first and appears above the other two group headers, while its pair GroupFooter1, appears below the other two group footers.

When you run a report with multiple groupings like the one above, the sections print in the following order:

  1. ReportHeader1 prints once and does not repeat.
  2. PageHeader1 prints once at the top of each page.
  3. GroupHeader1 prints once for the first value its DataField returns.
  4. GroupHeader2 prints once for the first value its DataField returns within the context of GroupHeader1's DataField value.
  5. GroupHeader3 prints once for the first value its DataField returns within the context of GroupHeader2's DataField value.
  6. Detail1 prints once for each record that falls within the context of GroupHeader3's DataField value.
  7. GroupFooter3 prints once at the end of the records that fall within the context of GroupHeader3's DataField value.
  8. GroupHeader3 may print again, if more values return within the context of GroupHeader2's DataField value.
  9. Each time GroupHeader3 prints again, it is followed by Detail1 (once for each related record) and GroupFooter3.
  10. GroupFooter2 prints once after GroupFooter3.
  11. GroupHeader2 may print again, if more values return within the context of GroupHeader1's DataField value.
  12. Each time GroupHeader2 prints again, it is followed by Detail1 (once for each related record) and GroupFooter2.
  13. GroupFooter1 prints once after GroupFooter2.
  14. GroupHeader1 prints once for the second value its DataField returns, followed by GroupHeader2, and so on in a pattern similar to the one above.
  15. ReportFooter1 prints once on the last page where the data displayed in the report ends.
  16. PageFooter1 prints once at the bottom of each page. Also, its position within groups varies.  
    Note: At design time, although the PageFooter section is located above the ReportFooter section, at run time it appears after the ReportFooter section on the last page.  

With many groupings, you might find the need to rearrange the order of your groups. If your report has more than one group, you can right-click the report surface, and select Reorder Groups. This opens the Group Order dialog, where you can drag the groups and set them in any order you want.

Alternatively, you can also click the Reorder Groups button in the ActiveReports toolbar, to open the Group Order dialog. See Toolbar for further information.

See Also

How To