Skip to main content
A newer version of this page is available. .

Group and Sort a Report's Data

  • 4 minutes to read

This document describes how to group and/or sort data in your report.

Group and Sort a Report’s Data

Do the following to group and/or sort data in your report:

  1. Create a new or open an existing data-bound report.

    You cannot apply grouping unless your report is bound to a data source.

  2. Switch to the Group and Sort panel, click Add a Group and select the required data field in the invoked drop-down menu.



    See the following tutorials to learn how to sort a report’s data by a custom field:

    This creates an empty group header with a corresponding group field added to its GroupHeaderBand.GroupFields collection.

    You can access this collection by clicking the group header’s smart tag:


    You can use the Group Field Collection Editor to group data by multiple criteria. Click Add to create a new group field in this editor and specify its GroupField.FieldName property.

    Use the up and down arrow buttons to specify the order in which these criteria are applied to the report’s data.


  3. Back in the Group and Sort panel, you can specify the group fields’ sorting order (ascending or descending).

    Select None if your groups are already ordered in the data source, and you do not need to sort them in the report.



    See Sort Groups by a Summary Function’s Result to learn how to sort groups by a summary.

  4. Click Show Footer to create an empty footer for this group.



    Disable the Show Header and Show Footer options to sort the report’s data without displaying any headers and footers.

  5. When a report has multiple groups, you can change their order by clicking Move Up or Move Down.


    The following images illustrate how a report looks when it is grouped by multiple criteria:

    A single group with multiple group fields Nested group header bands
    DataFeatures - Grouping6 DataFeatures - Grouping7
  6. Drag the corresponding field from the Field List and drop it onto the group footer to display the group field’s value in the report.


The resulting report looks as follows:


Specify the Group’s Settings

You can use the group band’s smart tag to customize the group’s layout settings:

  • Use the GroupHeaderBand.GroupUnion property to keep a group’s content on the same page when possible.


  • Use the Band.KeepTogether property to print the group header/footer on the same page as the group’s contents.


  • Use the GroupBand.RepeatEveryPage property to print the group band on each page.


  • Use the Band.PageBreak property to start a new page before or after each group.


  • When you need to display page numbers for individual groups, add the XRPageInfo control to the group header or footer and set its XRPageInfo.RunningBand property to the group header’s name.


    Accurate page numbering requires that different groups do not appear on the same page. For this reason, you need to set the group footer’s Band.PageBreak property to AfterBand, or place the XRPageBreak control at the band’s bottom.

    See Add Page Numbers to learn more.

Interactive Sorting in Print Preview

You can allow end-users to sort report data directly in Print Preview by clicking a designated element.


See Sort a Report in Print Preview for more information.

Unbound Group Bands

You can add an unbound group band to a report. An unbound band has no group fields defined. Set the band’s RepeatEveryPage property to control how the band appears in the report:

RepeatEveryPage Value

Group Band’s Appearance


Appears once at the report’s beginning / end.


Apppears on each page at the beginning / end.

See Also