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 for each 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. It is not necessary to use ActivateField on a field that is used in SetSearchExpr.

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, you would use the following VB syntax to avoid an SQL error:

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

The following VB 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 in Siebel eScript demonstrates how to log the current search specification to a file for debugging purposes:

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

Related Topics

ClearToQuery Method
ExecuteQuery Method
SetSearchSpec Method
SetSortSpec Method

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