Sort and Group Report Data
- 3 min to read
This tutorial describes how to sort and group data in a report created in previous tutorials as well as what options affect grouping behavior.
Sort Report Data
Select the detail report's Detail band and expand the Actions category in the Properties panel. In the Sort Fields section, click the plus button to create a new sorting field.
In the Sort By drop-down list, choose a data member across which the detail report should be sorted.
Click the corresponding arrow button to manage the sorting order for this criterion. The and icons indicate the ascending and descending sorting order, respectively. Click this button until it is marked with the icon to disable sorting.
You can define the priority for multiple sorting criteria using the and buttons.
Group Report Data
To split data into groups based on identical values in the Discount data field, do the following:
Switch to the Properties panel and add a Group Header band to the detail report by clicking the corresponding button in the Actions category. This band is displayed at the beginning of every group.
You can also accompany each Group Header by a Group Footer band, for instance, to display summary values.
Select the created Group Header, and in the Actions category, click the plus button for the Group Fields property.
Set the Group By property to a data member across which the report should be grouped.
Use the corresponding arrow button in the same way as for the sorting items to manage the sorting order of the group's items.
You can also add multiple data fields to this collection to group report data by the distinct combinations of these group field values.
Move the Discount data field specified as the grouping criterion from the Detail band to the Group Header band.
Specify Grouping Options
You can provide nested grouping for report data by creating multiple Group Header bands and specifying different group fields for them. In this scenario, a band's Level property determines the nesting level. Changing this property for the Group Header created in the previous section changes another Group Header automatically.
The Level property also allows you to associate a Group Header with the corresponding Group Footer.
The Group Union property specifies whether group rows are printed on different pages or the entire group should be printed on a single page. The Keep Together property, in turn, determines whether the contents of the group band can be split horizontally across pages.
Use the Repeat Every Page option to define whether a group band should be shown only on the first page that the group appears or on every page.
View the Result
Click the Preview toolbar button to see the result. The detail report data has become sorted by product names and grouped based on the grouping criteria value.