Bookshelf Home | Contents | Index | PDF |
Siebel Object Interfaces Reference > Interfaces Reference > Business Component Methods > SetSearchSpec MethodSetSearchSpec sets the search specification for a particular field. This method must be called before ExecuteQuery. SyntaxBusComp.SetSearchSpec FieldName, searchSpec ReturnsUsageTo avoid an unpredicted compound search specification on a business component, it is recommended to call ClearToQuery before calling SetSearchSpec. It is not necessary to use ActivateField on a field that is used in SetSearchSpec. If multiple calls are made to SetSearchSpec for a business component, then the multiple search specifications are handled as follows:
The maximum length of a predefined query is 2000 characters. CAUTION: Do not use SetSearchExpr and SetSearchSpec together because they are mutually exclusive. Using logical and comparison operators. Any search specification that can be created in the user interface can be duplicated in Siebel VB or eScript. Both logical operators and comparison operators may be used, provided that they are handled correctly. For example, in VB:
Using special characters. If the search specification contains any of the following characters. it must be enclosed in quotes. This rule applies to operators that are part of the search expression as well as text to search for. If the search expression contains quotes, those quotes must be doubled. For example, in the preceding line of code, notice that the entire search specification is enclosed in double quotes, whereas fields and values referred to within the specification each have single quotes. If the search object includes a single double quote, that quote must be doubled; for example, if you wanted to search for text containing: the VB search specification would take this form:
so that the initial quote is doubled, and the string containing it is placed within single quotes, and the entire expression, including the single quotes, is placed within double quotes. If the search specification includes single quotes (including apostrophes), the expression must be placed within single quotes, apostrophes must be doubled, and double quotes must be placed around the entire string. Thus, for example, if you wanted to search for "Phillie's Cheese Steaks" in the Name field, you would have to enter the specification in VB as follows: SetSearchSpec "Name", "'Phillie''s Cheese Steaks'" NOTE: eScript and Browser Script require backslashes instead of double quotes for marking special characters. For example: Searching for text in non-text fields. If the search expression queries a field of any type other than text, or if it is an expression other than a field-level query, text must be placed within quotes if it contains any characters other than the following: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz _ ? \ " ' [ As with text field search expressions, quotes must be doubled. Retrieving all records. To retrieve all records efficiently, use ClearToQuery followed by ExecuteQuery, without using SetSearchSpec. Searching for a null field. To search for null fields, use the following form: SetSearchSpec "Account", "is NULL" If your search specification requests an empty string, then the search returns every record. For example: Any dates used with SetSearchSpec must use the format MM/DD/YYYY, regardless of the Regional control panel settings of the server or client computer. Used WithCOM Data Control, COM Data Server, Java Data Bean, Mobile Web Client Automation Server, Server Script ExampleFor Siebel VB examples, read FirstRecord Method, SetFormattedFieldValue Method, and BusComp_PreQuery Event. For a Siebel eScript example, read ClearToQuery Method. ExampleThis Siebel VB code searches for a contact by name and then navigates to the record displayed in a view: (general) TheApplication.GotoView TargetView , NewBusObj The following example is in Siebel eScript: var oAccntBO = TheApplication().GetBusObject("Account"); oAddrBC = GetMVGBusComp("Street Address"); oAddrBC = null; Related TopicsExecuteQuery Method |
Siebel Object Interfaces Reference | Copyright © 2008, Oracle. All rights reserved. | |