Back to Devexpress

Group and Sort a Report's Data

xtrareports-1298-detailed-guide-to-devexpress-reporting-shape-report-data-group-and-sort-group-and-sort-a-reports-data.md

latest3.6 KB
Original Source

Group and Sort a Report's Data

  • Aug 12, 2019
  • 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.

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

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

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

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

  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.

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

| | --- | --- | |

false

|

Appears once at the report’s beginning / end.

| |

true

|

Apppears on each page at the beginning / end.

|

See Also

Count the Number of Groups in a Report

Limit the Number of Records per Group