Specifying the Sort Order and Sort Sequence
You can specify the sort order and sort sequence for returned records using the sortorder and sortsequence arguments respectively.
The sortorder and sortsequence arguments are specified as attributes of a FieldName element in requests, for example:
<CampaignName sortorder= "ASC " sortsequence= "1 "/>
which specifies that the records returned are sorted on the CampaignName field in an ascending order.
The sortsequence argument is used to specify the order in which sorting is applied if a sortorder value is specified on more than one field, for example:
<CampaignName sortorder= "ASC " sortsequence= "1 "/>
<Status sortorder= "ASC " sortsequence= "2 "/>"
Examples of sortorder and sortsequence usage are given in the following table.
Sort type | Usage of sortoder and sortsequence | Description |
---|---|---|
Sort in ascending order |
|
Returns all contacts whose ContactFirstName value starts with "Contact" and ends with zero or more characters and sorts them by ContactLastName in ascending order |
Sort in descending order |
|
Returns all contacts whose ContactLastName value starts with "Contact" and ends with zero or more characters and sorts them by ContactLastName in descending order |
Sort More than One Field |
|
Returns all contacts whose ContactFirstName value starts with "Contact" and ends with zero or more characters and sorts them by ContactLastName in descending order and then by ContactFirstName in descending order and then by ExternalSystemId in descending order. |