Create a Sort with the .NET Api

The following is a quick explanation for how to create a report Sort using the .NET Api.


Ensure that your application is referencing the Sort class, which is located in the WebReports.Api.Reports namespace.

using WebReports.Api.Reports;


/* Manually Creating a Sort */
Sort mySort = new Sort(myApi.PageInfo);

// mySort.Name = "Categories.CategoryName"; // deprecated in v2016.2
mySort.SortText = "Categories.CategoryName";
mySort.Direction = wrSortDirection.Ascending;




NOTE: Sorts created in the API are unique to their session.

Use the following constructor to create a new sort object:

Sort mySort = new Sort(myApi.PageInfo); - Requires the Api's PageInfo object as an argument.

Set the following fields:

mySort.Name - The mnemonic entity and column name to sort on. Use mySort.SortText in v2016.2 or later.

mySort.SortText - The full text of the sort (entity and column name or formula).

mySort.Direction - Whether to sort in Ascending (A-Z, 0-9) or Descending (Z-A, 9-0) direction. Accepts a wrSortDirection enumerator.

Then add the sort to the report:


NOTE: myReport.Sorts is an ordered list of sorts. To change the order of precedence, re-order the list.

Hidden Article Information

Article Author
Exago Development
created 2016-03-10 20:27:37 UTC
updated 2017-02-21 16:46:10 UTC

Sorting, How Do I, API, .NET, How-To,
Have more questions? Submit a request