Adding Groups to Report
Report groups are defined by adding Group objects to the report’s Groups collection. Report groups are always nested according to the order in the Group's collection. To display group data one should use the GroupHeaderSection and GroupFooterSection that appear once for each group member, respectively at start and end. The DetailSection displays detailed data in a report and always appears inside the innermost group (if any). To add a group, follow these steps:
Adding a group to a Report using Report Designer
- Click the Report selector button located in the upper left hand of the Report Designer
- Click the Groups ellipsis.
-
Follow these steps for each group:
- Click the Add button - a new unbound group will be added to the Groups collection.
- Click the Grouping property ellipsis.
- From the Edit Grouping dialog, type or select an expression by which to group the data.
-
To apply sorting to the group, follow these steps:
- Click the Sorting ellipsis.
- Click New.
- Type or select an expression by which to sort the data.
- From the Direction column drop-down list, choose the sort direction for each expression. ASC sorts the expressions in ascending order. DESC sorts the expressions in descending order.
-
To apply filtering to the group, follow these steps:
- Click the Filters ellipsis.
- Click New.
- In Expression, type or select the expression for the field to filter. To open the Edit Expression Dialog, select the
<Expression>
option. - In the Operator box, select the operator that you want the filter to use to compare the values in the Expression box and the Value box.
- In the Value box, type the expression or value against which you want the filter to evaluate the value in Expression.
In Name, type the name of the group.
- Click GroupKeepTogether to specify the keep-together options.
- Click BookMarkID to set a BookMark for this group.
Click Ok twice to close the Edit Grouping and Group Collection dialogs.
You can add a group to the Report item by using the grouping pane in the Group Explorer as well. To do so right click on the detail and select Add Parent Group. If there are existing groups, you can create Parent or Child groups by right-clicking on any of the existing groups.
Edit a group in a Report using Report Designer
- In the Report Designer, click the Report selector button located in the upper left hand of the Report Designer to make the report active in the Properties window. The Grouping pane in the Group Explorer displays the available groups (if any).
- Right-click the group, and then click Group Properties.
- In Name, type the name of the group.
- In Grouping property, type or select a simple expression, or click the
<Expression>
option to create a new group expression. - Click New to create additional expressions. All expressions you specify are combined using a logical AND to specify data for this group.
-
To allow sorting for the group, follow these steps:
- Click the Sorting ellipsis.
- Click New.
- Type or select an expression by which to sort the data.
- From the Direction column drop-down list, choose the sort direction for each expression. ASC sorts the expressions in ascending order. DESC sorts the expressions in descending order.
-
To allow filtering for the group, follow these steps:
- Click the Filters ellipsis
- Click New.
- In Expression, type or select the expression for the field to filter. To open the Edit Expression Dialog, select the
<Expression>
option. - In the Operator box, select the operator that you want the filter to use to compare the values in the Expression box and the Value box.
- In the Value box, type the expression or value against which you want the filter to evaluate the value in Expression.
Click GroupKeepTogether to specify the keep together options.
- Click BookMarkID to set a BookMark for this group.
Delete a group from a Report using Report Designer
- Click the Report selector button located in the upper left hand of the Report Designer. This makes the report active in the Properties window. The grouping pane in the Group Explorer displays the available groups (if any).
- Right-click on the group and select Delete Group.
- When prompted to delete it, Select Yes.
Adding a group to a Report programmatically
Telerik.Reporting.Group group1 = new Telerik.Reporting.Group();
group1.Name = "group1";
group1.Groupings.Add(new Telerik.Reporting.Grouping("=Fields.ProductID"));
Telerik.Reporting.GroupFooterSection groupFooterSection1 = new Telerik.Reporting.GroupFooterSection();
Telerik.Reporting.GroupHeaderSection groupHeaderSection1 = new Telerik.Reporting.GroupHeaderSection();
group1.GroupFooter = groupFooterSection1;
group1.GroupHeader = groupHeaderSection1;
//if you need to filter the data, apply filtering
group1.Filters.Add(new Telerik.Reporting.Filter("=Fields.ProductID", Telerik.Reporting.FilterOperator.Equal, "=10"));
//if you need to sort the data, apply sorting
group1.Sortings.Add(new Telerik.Reporting.Sorting("=Fields.ProductID", Telerik.Reporting.SortDirection.Asc));
report1.Groups.Add(group1);
Dim group1 As New Telerik.Reporting.Group()
group1.Name = "group1"
group1.Groupings.Add(New Telerik.Reporting.Grouping("=Fields.ProductID"))
Dim groupFooterSection1 As New Telerik.Reporting.GroupFooterSection()
Dim groupHeaderSection1 As New Telerik.Reporting.GroupHeaderSection()
group1.GroupFooter = groupFooterSection1
group1.GroupHeader = groupHeaderSection1
'if you need to filter the data, apply filtering
group1.Filters.Add(New Telerik.Reporting.Filter("=Fields.ProductID", Telerik.Reporting.FilterOperator.Equal, "=10"))
'if you need to sort the data, apply sorting
group1.Sortings.Add(New Telerik.Reporting.Sorting("=Fields.ProductID", Telerik.Reporting.SortDirection.Asc))
report1.Groups.Add(group1)