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

SetSearchExpr


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.

Syntax

oBusComp.SetSearchExpr searchSpec

Argument
Description
searchSpec
Search specification string field

Returns

Not applicable

Usage

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.

Used With

Browser Script, COM Data Control, COM Data Server, CORBA Object Manager, Java Data Bean, Mobile/Dedicated Web Client Automation Server, Server Script

See Also

ClearToQuery
ExecuteQuery
SetSearchSpec
SetSortSpec

Example

Here is an eScript example:

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

BC.ClearToQuery();
BC.SetSearchExpr(searchst);
BC.ExecuteQuery();


 Siebel Object Interfaces Reference 
 Published: 18 June 2003