This article explains the steps required for creating a Report with Groups.
1. Create a report or open an existing one. For example, we can take a simple list report that was created in the separate article called, "Simple List Report".
Note: Edit the Dataset to include the column on which grouping will be done.
1. Add GroupHeaderBand and GroupFooterBand to the report template. The GroupHeaderBand should be placed higher than the DataBand to which it is related to. The GroupFooterBand is placed under the Data to which the GroupHeader is related to. Each GroupFooter corresponds to a specified GroupHeader. The GroupFooter band will not output without a GroupHeader.
Figure 1 : Template with Group Header and Footer band
1. Edit the GroupHeaderBand and GroupFooterBand:
· Align them be height
· Change the values of the properties according to requirements. For example, set the KeepGroupHeaderTogether property for the GroupHeaderBand to True, if it is necessary to keep the group header with the group. And for the GroupFooterBand set the KeepFooterTogether property to True, if it is required to keep the footer with the group.
· Set the background of the GroupHeaderBand.
· Enable Borders of the DataBand, if required.
1. Set the condition data grouping in the report using the Condition property of the GroupHeaderBand. The Condition of the grouping can be set by setting the expression or by selecting the data column from the data source.
1. Put a text component in the GroupHeaderBand and put the expression into this text component. Put a text component in the GroupFooterBand and put the expression {Count ()} into this text component. The {Count ()} function will perform a count summary by the amount of entries in each group.
1. Edit expressions and text components:
· Drag and drop the text component in the GroupHeaderBand and GroupFooterBand
· Change parameters of the text font: size, type and colour
· Align the text component by width and height
· Change the background of the text component
· Align text in the text component
· Change the value of properties of the text component. For example, set the Word Wrap property to True, if you need the text to be wrapped
· Enable Borders for the text component, if required.
· Change the border colour.
The picture below shows a sample of the edited report template with grouping:
Figure 2 : Report Template with Grouping
1. Click the [Preview] button or invoke the Viewer by pressing F5 or clicking the Preview menu item. After rendering, all references to data fields will be changed on the data form specified fields. Data will be output in consecutive order from the database that was defined for this report. The amount of copies of the DataBand in the rendered report will be the same as the amount of data rows in the database. The picture below shows a sample of the report with grouping:
Figure 3 : Report with Group