In Telerik Reporting data items can order the data they are bound to by taking advantage of the sorting capabilities of the Telerik Reporting engine.
Sorting can be performed at the data item and group level through the Sorting collections. Sorting for groups controls the order of grouping data, not the detail data. Group level sorting occurs before the sorting for the report as a whole.
You specify the sorting criteria by adding Telerik.Reporting..::..Sorting objects to the data items’ or groups’ Sorting collections. Each sorting is made up of an Expression and a Direction:
- Expression can be a single data field or a combination of multiple expressions. See Expressions.
- Direction can be either "Asc" (ascending) or "Desc" (descending).
Data items and groups may contain one or more Sortings that are combined at runtime and applied together to the data.
Sorting criteria is defined through the Edit Sorting Dialog.
Depending on where the Sorting is applied – to a data item or a group – it may produce different results:
- A sorting applied to a data item sets the order of the detail data thus resulting on the order of appearance of the detail rows (including the DetailSection and detail groups). As the First and Last aggregate functions depend on the order of the data they operate with, they may return different values depending on the data items’ sorting.
- A sorting applied to a group sets the order of the members of this group thus resulting on the order of appearance of the rows/columns depending on if this is a row or column group.