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

Sort Groups by a Summary Function's Result

  • 2 minutes to read

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.

HowTo_SortGroupsBySummary_2

Do the following to sort a report’s groups by a summary function’s result:

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

  2. To get started with this tutorial, group the report by the CategoryID data field.

    HowTo_SortGroupsBySummary_0

  3. Click the Group Header band’s smart tag, and click the ellipsis button for the GroupHeaderBand.SortingSummary property in the invoked actions list.

    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.

    HowTo_SortGroupsBySummary_1

    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.