Sorting data can be especially useful to Report Editors as it gives them control over the order in which data is returned in the report. This article will cover the details of adding sorting criteria to Range List functions.
When building reports, it is oftentimes useful to be able to control the order in which data is returned by a Range List function. Since sorting is dynamic, and happens when the report is run, all sorting must be done in Range Lists. This will control the order that data is returned by the Range List, which will then determine the order that all Field Lookup Functions and Aggregate Functions are returned.
Adding a Single Sort to a Range List
To add a single sort to a Range List, the user will select the Range List that should be sorted and open the Range Lists section in the Cosmos Task Pane and click EDIT. Then click the + sign.
The user will be presented with the option to select the Sort Field to apply the sort to. Only fields that exist in the table that the Range List function is pulling from are eligible to be sorted on. The user can also specify whether the Sort Order should be in Ascending Order or Descending Order.
In the example below the user has chosen to sort the customer list by the customer number, so that when the report is run the customers will be returned based alphabetically by customer number.
The resulting report run would look like this, with all customers being returned sorted alphabetically by customer number:
Adding Multiple Sorts to a Range List
In addition to sorting on a single field, the user can add multiple sorts to have greater control over how data is sorted when the report is run. To add additional sort criteria, the user can click the + sign to add as many levels of sorting as needed.
When adding multiple levels of sorting, it is important to note that the data will be sorted in the order that the sort fields appear in the Sorts section of the Cosmos Task Pane. In the example below, the data will first be sorted by Country Name and, within that sorting, data will then be returned sorted by customer name.
Below is an example of the run version of this report. You can see that within each country grouping the customer names are sorted alphabetically:
Deleting a Sort
To delete a sort the user should navigate to the Sorts section of the desired Range List function in the Cosmos Task Pane and click the trash can icon to the right of the sort to be deleted. This will remove the sort from the function. The example below shows the icons to remove sorts highlighted in red.