New to Telerik Reporting? Download free 30-day trial

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 Groups 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 detail 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

  1. Click the Report selector button located in the upper left hand of the Report Designer
  2. Click the Groups ellipsis.
  3. Follow these steps for each group:

    1. Click Add button - a new unbound group will be added to the Groups collection.
    2. Click the Grouping property ellipsis.
    3. From the Edit Grouping dialog, type or select an expression by which to group the data.
    4. 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 expression in ascending order. DESC sorts the expression in descending order.
    5. 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.
    6. In Name, type the name of the group.

    7. Click GroupKeepTogether to specify the keep together options.
    8. Click BookMarkID to set a BookMark for this group.
  4. 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

  1. 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).
  2. Right-click the group, and then click Group Properties.
  3. In Name, type the name of the group.
  4. In Grouping property, type or select a simple expression, or click the <Expression> option to create a new group expression.
  5. Click New to create additional expressions. All expressions you specify are combined using a logical AND to specify data for this group.
  6. 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 expression in ascending order. DESC sorts the expression in descending order.
  7. 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.
  8. Click GroupKeepTogether to specify the keep together options.

  9. Click BookMarkID to set a BookMark for this group.

Delete a group from a Report using Report Designer

  1. 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).
  2. Right click on the group and select Delete Group.
  3. 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)

See Also

In this article