Show/Hide Toolbars

TMS XData Documentation

The $orderby query option can be used in a URL query string to determine which values are used to order the entities in the entity set. The $orderby option only applies for URI addressing entity sets. The format is the following:


$orderby=<expression> [asc/desc]

$orderby=<expression> [asc/desc], <expression> [asc/desc], ... , <expression> [asc/desc]


Where <expression> must contain the value by which the entities must be order, which is mostly the name of a property of sub property. Example:




The asc/desc identifier is optional and indicates if the entities must be sorted by the specified expression values in ascending or descending order. If not specified, ascending order is used. You can use slashes to access associations (navigation properties) and sort by values of such associations. As an example, the following URI will retrieve all invoices sorted by the name of the customer's country associated with that invoice, in descending order:


http://server:2001/tms/xdata/Invoice?$orderby=Customer/Country/Name desc


You can also order by multiple values, separated by comma. The following example lists all customers by last name and for customers with the same last name, by first name;