Bookshelf Home | Contents | Index | Search | PDF |
Siebel Object Interfaces Reference > Interfaces Reference > Business Component Methods >
SetSortSpec
SetSortSpec sets the sorting specification for a query.
Syntax
oBusComp.SetSortSpec sortSpec
Returns
Not applicable
Usage
SetSortSpec, if used, must be called after ClearToQuery and before ExecuteQuery. The sortSpec argument is a string of the form:
"
fieldName1
,
fieldName2
,...(ASCENDING)"
or
"
fieldName1
,
fieldName2
,...(DESCENDING)"
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)"
BC.SetSortSpec "Name(ASCENDING)"
Used With
Server Script, Mobile/Dedicated Web Client Automation Server, COM Data Control, COM Data Server, Java Data Bean, CORBA Object Manager
Example
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
With Me
.ActivateField("Account")
.ActivateField("Account Location")
.ClearToQuery
.SetSortSpec "Account(DESCENDING), Account Location(ASCENDING)"
.ExecuteQuery
End WithBusComp_PreQuery = ContinueOperation
End Function
Here is the same example in Siebel eScript.
Function BusComp_PreQuery
with (this)
{
ActivateField("Account");
ActivateField("Account Location");
ClearToQuery();
SetSortSpec("Account(DESCENDING), Account Location(ASCENDING)");
ExecuteQuery();
}return (ContinueOperation);
}
See Also
Bookshelf Home | Contents | Index | Search | PDF |
Siebel Object Interfaces Reference Published: 18 June 2003 |