The requested page is not available for the requested platform. You are viewing the content for Default platform.

Group and Sort a Report's Data

  • 3 min 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.

    group-data-panel-select-group-field

    Tip

    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:

    group-data-band-field-collection

    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.

    group-data-field-collection-editor

  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.

    group-data-panel-sort-order

    Tip

    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.

    group-data-panel-show-footer

    Tip

    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.

    group-data-panel-move-up

    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.

    group-data-drag-field-list

The resulting report looks as follows:

group-data-preview-result

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.

    group-data-union-smart-tag

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

    group-data-keep-together-smart-tag

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

    group-data-repeat-every-page-smart-tag

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

    group-data-page-break-smart-tag

  • 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.

    HowTo_PageNumbers4Groups_4

    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.

interactive-sorting-detail-result

See Sort a Report in Print Preview for more information.

See Also