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;
myReport.Sorts.Add(mySort);
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:
myReport.Sorts.Add(mySort);
NOTE: myReport.Sorts is an ordered list of sorts. To change the order of precedence, re-order the list.