Siebel Object Interfaces Reference > Interfaces Reference > Business Component Methods >
SetSortSpec sets the sorting specification for a query.
String containing the sort specification
SetSortSpec, if used, must be called after ClearToQuery and before ExecuteQuery. The sortSpec argument is a string of the form:
The entire string must be placed in quotes. You can sort on various fields in different orders by separating the field names and order specifications with commas, as in the example.
The argument assigned to SetSortSpec is the same used after the equal sign in a predefined query. For example, the first line following is a sort specification in a predefined query; the second is the equivalent sort specification used with the various interface methods. Note that Name is the name of a business component field.
'Account'.Sort = "Name(ASCENDING)"
Any dates used with SetSortSpec must use the format MM/DD/YYYY, regardless of the Regional control panel settings of the server or client computer.
COM Data Control, COM Data Server, Java Data Bean, Mobile Web Client Automation Server, Server Script
This Siebel VB example sorts the Opportunity list first by Account in reverse order, then in alphabetical order by Site. Note that the column names in the Opportunity list applet are not the same as those in the underlying business component.
NOTE: This example merely demonstrates how to sort in ascending and descending order. In actual practice you should not sort in both directions in a single sort specification, as it degrades performance considerably.
Function BusComp_PreQuery As Integer
.SetSortSpec "Account(DESCENDING), Account Location(ASCENDING)"
BusComp_PreQuery = ContinueOperation
The following is the equivalent example in Siebel eScript.
SetSortSpec("Account(DESCENDING), Account Location(ASCENDING)");