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

SetSearchExpr Method

SetSearchExpr sets an entire search expression on the business component, rather than setting one search specification per field. Syntax is similar to that on the Predefined Queries screen.


BusComp.SetSearchExpr searchSpec



Search specification string field


Not applicable


Call this method after ClearToQuery and before ExecuteQuery.

The maximum length of a predefined query is 2000 characters. The argument assigned to SetSearchExpr is the same as that used after the equal sign in a predefined query. For example, the first line following is a search specification in a predefined query; the second is the equivalent search specification used with the various interface methods. Note that Name is a field on the business component and therefore must be enclosed in brackets, [ ].

'Account'.Search = "[Name] ~ LIKE ""A. C. Parker"" "

BC.SetSearchExpr "[Name] ~ LIKE ""A. C. Parker"" "

If field values have search keywords such as NOT, AND, and OR, use two pairs of double quotes around the field value. For example, if a field Sub-Status can have the string "Not an Issue" as a field value, then use the following syntax to avoid an SQL error:

substatus = GetFieldValue("Sub-Status")
searchst = "[Value] = """ & substatus & """""
BC.SetSearchExpr searchst

The following syntax generates an SQL error.

substatus = GetFieldValue("Sub-Status")
searchst = "[Value] = " & substatus
BC.SetSearchExpr searchst

Use both SetSearchExpr and SetSortSpec to build a query that includes both a search specification and a sort specification. You cannot set a sort specification with SetSearchExpr by itself. Do not use SetSearchExpr and SetSearchSpec together; they are mutually exclusive.

Any dates used with SetSearchExpr must use the format MM/DD/YYYY, regardless of the Regional control panel settings of the server or client computer.

Used With

Browser Script, COM Data Control, COM Data Server, Java Data Bean, Mobile Web Client Automation Server, Server Script


The following example is in Siebel eScript:

var Ob = TheApplication().ActiveBusObject();
var BC = Ob.GetBusComp("Opportunity");
var Account = "Turston Steel";
var Oppty = "CAD/CAM implementation";
var searchst = "[Name] = '" + Oppty + "' AND [Account] = '" + Account + "'";

TheApplication().TraceOn("c:\\temp\\trace.txt", "Allocation", "All");
TheApplication().Trace("the search expression is: " + searchst);

See Also

ClearToQuery Method
ExecuteQuery Method
SetSearchSpec Method
SetSortSpec Method

Siebel Object Interfaces Reference