Siebel Object Interfaces Reference > Interfaces Reference > Business Component Methods >

SetSortSpec Method

SetSortSpec sets the sort specification for a query.


BusComp.SetSortSpec sortSpec



String containing the sort specification


Not applicable


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)"

BC.SetSortSpec "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.

Used With

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

With Me
   .ActivateField("Account Location")
   .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 Location");
   SetSortSpec("Account(DESCENDING), Account Location(ASCENDING)");


Related Topics

GetSortSpec Method
SetSearchExpr Method
SetSearchSpec Method

Siebel Object Interfaces Reference Copyright © 2008, Oracle. All rights reserved.