In Reportizer reports, you can divide data records into separate groups. Grouping is used to mark out different groups, place group headers in report, calculate and output group totals, and so on.
Records are divided into groups using grouping expressions. Before formatting each new data record, the grouping expressions are calculated. If the calculation result was changed since the previous one, the current group ends and the new one begins.
There can be up to three group levels in the report. Each level is determined by corresponding grouping expression of Report object. For example, Grouping Expression 1 specifies condition for grouping of the first level, Grouping Expression 2 specifies condition for grouping of the second level, and so on. Groups of level 2 are nested in group of level 1, and so on. Each group level has its own Group Header and Group Totals bands.
When the group begins, the group totals expressions (if any) are initialized and the corresponding Group Header band is outputted (if the band's Visible property set to Yes). When the group ends, the corresponding Group Totals band is outputted (if the band's Visible property set to Yes).
1. In the report data source, specify correct sorting of data. Usually, this is done by using ORDER BY clause in SQL expression. For example, if you want to make groups, based on value of MONTH field, and a subgroup, based on value of CUSTOMER field, you should use ORDER BY MONTH, CUSTOMER clause in your data source SQL text.
2. Specify grouping expressions. For example, if you want to make groups, based on value of MONTH field, and a subgroup, based on value of CUSTOMER field, you may specify value of Grouping Expression 1 as dataset_field_val(1, 'MONTH'), and value of Grouping Expression 2 as dataset_field_val(1, 'CUSTOMER'). If you are in creating new report, this can be done in the last step in the 'New report template' wizard: please, move to 'Grouping records' pane, and specify grouping expressions of needed levels. If you are editing existing report, please open Report Builder, move to Object Inspector window (if it is not visible, press F11), select Report object from dropdown list at the top, find grouping expressions among the Report properties, and specify values for needed expressions.
3. If it is needed, specify which group related bands to show in report. If you are in creating new report, this can be done in the last step in the "New report template' wizard: please, move to 'Grouping records' pane, and check the corresponding checkboxes. If you are editing existing report, please open Report Builder, move to Object Tree window (if it is not visible, choose Options | Toolbars | Object Tree menu), and check the corresponding bands. Then, in Report Builder, you can place text or graphic objects on those bands.
There are several demo reports in Examples folder, which demonstrate using groups.