Siebel Object Interfaces Reference > Interfaces Reference > Business Component Methods >
SetNamedSearch sets a named search specification on the business component. A named search specification is identified by the searchName argument.
BusComp.SetNamedSearch searchName, searchSpec
String containing the name of the named search specification
String containing the search specification string corresponding to the name
A named search specification is a search criterion that is not cleared by the ClearToQuery; for example, a predefined query or business component search specification.
A named search specification can be modified only programmatically; it cannot be modified through the UI. This specification is applied in conjunction with the existing search specification. When set, the named search specification is applied every time ExecuteQuery is called. ClearToQuery does not clear the named search specification. To clear it, explicitly set the searchSpec argument to "". Note that when a new instance of the BusComp is created, the named search specification is cleared.
The searchSpec argument assigned to SetNamedSearch is the same argument that is used after the equal sign in a predefined query. The maximum length of a predefined query is 2000 characters. For details on how to set up the search specification, read SetSearchExpr Method and SetSearchSpec Method.
COM Data Control, COM Data Server, Java Data Bean, Mobile Web Client Automation Server, Server Script
This example shows how to set a named search to a business component depending on the position of the current user.
The following example is in Siebel eScript:
function BusComp_PreQuery ()
if (TheApplication().GetProfileAttr("Position") == "Siebel Administrator");
this.SetNamedSearch ("Candidates", "[Status] LIKE 'Candidate'")
The following example is in Siebel VB:
Function BusComp_PreQuery () As Integer
If TheApplication.GetProfileAttr("Position") = "Siebel Administrator" Then
Me.SetNamedSearch "Candidates", "[Status] LIKE 'Candidate'"
BusComp_PreQuery = ContinueOperation
Note that defining searches using the SetNamedSearch method does not create a PDQ entry, this is a search specified in script only. To retrieve this search specification, use GetNamedSearch method. GetProfileAttr is used in personalization to retrieve values of an attribute in a user profile.