Sort Groups by a Summary Function's Result
- 2 minutes to read
Online Example: How to sort groups by number of records in the group
This tutorial explains how to sort groups by a summary function result at design time within Visual Studio. In the report created in this tutorial, groups are sorted by the number of records they contain.
Do the following to sort a report's groups by a summary function's result:
To create a table report in this tutorial, start with a report that is bound to the "Products" table of the sample Northwind database (the nwind.mdb file included in the XtraReports installation).
See Provide Data to Reports to learn more about binding a report to a data source.
To get started with this tutorial, group the report by the CategoryID data field.
In the invoked Group Sorting Summary Editor, turn on the Enabled option, set the Field option to ProductName, and set the Summary function to Count.
In this editor, you can also define the sorting direction for the group, as well as specify whether or not the Null values should be ignored.
Click OK to apply the changes and close the dialog.