SetSortSpec Method for a Business Component
The SetSortSpec method sets the sort specification for a business component. This method does not return any information.
Format
BusComp.SetSortSpec sortSpec
The following table describes the arguments for the SetSortSpec method.
Argument | Description |
---|---|
sortSpec |
String that contains the sort specification. |
The sortSpec argument uses the following format:
"fieldName1,fieldName2,...(ASCENDING)"
or
"fieldName1,fieldName2,...(DESCENDING)"
You must enclose the entire string in double quotes. To sort on various fields in different orders, you can use a comma to separate field names and order specifications.
Usage
If you use the SetSortSpec method, then you must call it after you call the ClearToQuery method and before you call the ExecuteQuery method.
The SortSpec argument works in the same way as the equal sign in a predefined query. For example, consider the following predefined query:
'Account'.Sort = "Name(ASCENDING)"
You can use the following equivalent search specification in various interface methods:
BC.SetSortSpec "Name(ASCENDING)"
Note that Name is the value in the Name property of the business component field. This example queries the Name field.
Any date you use with the SetSortSpec method must use the MM/DD/YYYY format, regardless of the Regional control panel settings of the Siebel Server or Siebel client.
Used With
COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples
The Siebel VB example in this topic sorts the Opportunity list first by Account in reverse order, and then in alphabetical order by Site. Note that the column names in the Opportunity list applet are not the same as the names in the underlying business component.
For demonstration purposes, this example sorts in ascending and descending order. In actual practice, do not sort in two directions in a single sort specification because this type of sorting can significantly degrade performance.
Function BusComp_PreQuery As Integer
With Me
.ActivateField("Account")
.ActivateField("Account Location")
.ClearToQuery
.SetSortSpec "Account(DESCENDING), Account Location(ASCENDING)"
.ExecuteQuery ForwardBackward
End With
End Function
The following is the equivalent example in Siebel eScript:
function BusComp_PreQuery {
with (this)
{
ActivateField("Account");
ActivateField("Account Location");
ClearToQuery();
SetSortSpec("Account(DESCENDING), Account Location(ASCENDING)");
ExecuteQuery(ForwardBackward);
}
}
Related Topics
For more information, see the following topics: