In a section report, you can group data by adding a pair of and sections to the report. These sections appear immediately above and below the 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
- Name (Name): Indicates the name of the GroupHeader in code. It is unique for a report.
- Tag (Tag): Indicates the user-defined information persisted with the GroupHeader section.
- Visible (Visible): Checkbox to specify the visibility of the GroupHeader section.
- DataField (DataField): Field or expression on which you group the data.
Appearance
- Background color (BackColor): Dropdown list to set the background color of the GroupHeader section.
Layout
- Insert new page (NewPage): Dropdown list to determine whether a new page is inserted before and/or after displaying the GroupHeader section.
- Insert new column (NewColumn): Dropdown list to determine whether a new column (in a multi-column report) appears before and/or after displaying the GroupHeader section.
- Repeat section (RepeatStyle): Dropdown list to specify whether the GroupHeader section appears with every column or page that the Detail section or associated footer appears on.
- Keep section and its footer on a single page (GroupKeepTogether): Dropdown list to specify whether the GroupHeader section and its footer appear as a single block on the same page or not.
- Keep section on a single page (KeepTogether): Checkbox to specify whether the GroupHeader section appears on a single page.
- Keep section and its footer in a single column (ColumnGroupKeepTogether): Checkbox to specify whether the GroupHeader section and its footer appear as a single block in the same column.
- Keep section underneath the following section (UnderlayNext): Checkbox to specify whether the GroupHeader section appears in the following section or not. It allows you to show group header information inside the group details, so long as you keep the BackColor property of the Detail section set to Transparent.
- Use column layout (ColumnLayout): Checkbox to determine whether the GroupHeader section uses the same column layout as the Detail section.
- Can increase to accommodate contents (CanGrow): Checkbox to specify whether the height of the GroupHeader section can grow when its controls extend beyond its original height.
- Can decrease to accommodate contents (CanShrink): Checkbox to specify whether the height of the GroupHeader section can adjust to the total height of controls placed in it.
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
- Name (Name): Indicates the name of the GroupFooter in code. It is unique for a report.
- Tag (Tag): Indicates the user-defined information persisted with the GroupFooter section.
- Visible (Visible): Checkbox to specify the visibility of the GroupFooter section.
Appearance
- Background color (BackColor): Dropdown list to set the background color of the GroupFooter section.
Layout
- Insert new page (NewPage): Dropdown list to determine whether a new page is inserted before and/or after displaying the GroupFooter section.
- Insert new column (NewColumn): Dropdown list to determine whether a new column (in a multi-column report) appears before and/or after displaying the GroupFooter section.
- Keep section on a single page (KeepTogether): Checkbox to determine whether the GroupFooter section appears on a single page.
- Use column layout (ColumnLayout): Checkbox to specify whether the GroupFooter section uses the same column layout as the Detail section.
- Print at the bottom of page (PrintAtBottom): Checkbox to specify whether the GroupFooter section is printed at the bottom of the page immediately before the PageFooter section.
- Can increase to accommodate contents (CanGrow): Checkbox to specify whether the height of the GroupFooter section can grow when its controls extend beyond its original height.
- Can decrease to accommodate contents (CanShrink): Checkbox to specify whether the height of the GroupFooter section can adjust to the total height of controls placed in it.
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:
- ReportHeader1 prints once and does not repeat.
- PageHeader1 prints once at the top of each page.
- GroupHeader1 prints once for the first value its DataField returns.
- GroupHeader2 prints once for the first value its DataField returns within the context of GroupHeader1's DataField value.
- GroupHeader3 prints once for the first value its DataField returns within the context of GroupHeader2's DataField value.
- Detail1 prints once for each record that falls within the context of GroupHeader3's DataField value.
- GroupFooter3 prints once at the end of the records that fall within the context of GroupHeader3's DataField value.
- GroupHeader3 may print again, if more values return within the context of GroupHeader2's DataField value.
- Each time GroupHeader3 prints again, it is followed by Detail1 (once for each related record) and GroupFooter3.
- GroupFooter2 prints once after GroupFooter3.
- GroupHeader2 may print again, if more values return within the context of GroupHeader1's DataField value.
- Each time GroupHeader2 prints again, it is followed by Detail1 (once for each related record) and GroupFooter2.
- GroupFooter1 prints once after GroupFooter2.
- GroupHeader1 prints once for the second value its DataField returns, followed by GroupHeader2, and so on in a pattern similar to the one above.
- ReportFooter1 prints once on the last page where the data displayed in the report ends.
-
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 runtime 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