Log In
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
 [Expand]Product Information
 [Expand]Getting Started
 [Expand]Fundamental Concepts
  [Expand]Report Types
  [Expand]Report Controls
  [Expand]Platform-Specific Reporting
  [Collapse]Creating Reports
   [Expand]Providing Data to Reports
   [Expand]Providing Data To Report Controls
   [Collapse]Shaping Data
     Grouping Data
     Sorting Data
     Filtering Data
     Calculating Summaries
     Formatting Data
   [Expand]Using Report Parameters
   [Expand]Appearance Customization
   [Expand]Navigation and Interaction
  [Expand]Storing Reports
  [Expand]Publishing Reports
  [Expand]End-User Reporting
  [Expand]Application Appearance
  [Expand]Migration to XtraReports
 [Expand]Design-Time Features
  End-User Capabilities
 [Expand]Redistribution and Deployment
 [Expand]API Reference
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Sorting Data

This document describes existing approaches for sorting report detail data and its groups. This page also demonstrates how to implement custom logic for sorting report data and how to provide the sorting capability to your end-users.

The document consists of the following sections.

Expanded Sort Detail Data

To sort report data against a single data column, or multiple data columns, add it to the DetailBand.SortFields collection of a report's Detail band. There are two main approaches to doing this at design time.

  • The simplest way of sorting report data is to utilize the Group and Sort Panel.

    For a step-by step tutorial that explains how to use the Group and Sort Panel, see How to: Sort Data.

  • Another approach is to access the Detail band's DetailBand.SortFields collection from the band's actions list (which is invoked by clicking the band's smart tag). In this actions list, click the ellipsis button for the DetailBand.SortFields property.

    After the GroupField Collection Editor is invoked, you can create multiple sorting criteria and define a sorting direction for each criteria.

A runtime approach to data sorting is shown in the How to: Sort Data (Runtime Sample) topic.

Expanded Sort Groups

You can sort report groups by the result of a summary function. This function can either be predefined or custom.

Expanded Custom Sorting

If the standard sorting algorithms do no suit your requirements, you can implement custom logic for sorting report data. To accomplish this, create a calculated field, handle its CalculatedField.GetValue event to evaluate the required value, and then group and/or sort report data against this field.

For a step-by-step tutorial, refer to the How to: Custom Sort Data topic. For more examples, see How to custom sort items in a report.

Expanded End-User Sorting

You can allow your end-users to sort report data directly in the Print Preview by clicking a designated element.

See the How to: Sort a Report in the Preview document for more information.

Expanded See Also

How would you rate this topic?​​​​​​​