Bookshelf Home | Contents | Index | Search | PDF |
Siebel Object Interfaces Reference > Interfaces Reference > Business Component Methods >
ExecuteQuery
ExecuteQuery returns a set of BusComp records using the criteria established with methods such as SetSearchSpec.
Syntax
BusComp.ExecuteQuery (cursorMode)
Argument Description cursorMode An integer. An optional parameter that must be one of the following constants (provided in Siebel VB as well as COM Servers):Returns
Not applicable
Usage
Use a cursorMode of ForwardOnly wherever possible to achieve maximum performance. If you use ForwardOnly, make sure that your application code does not attempt to navigate backward using PreviousRecord or FirstRecord without a requery. Do not use ForwardOnly when operating on UI business components unless the application code requeries using a cursorMode of ForwardBackward.
When using the ForwardBackward cursor mode, and the query matches over 10,000 records, the object manager returns this error message: "There were more rows than could be returned. Please refine your query to bring back fewer rows." To remove the 10,000 record restriction, set the following parameter in the data source section of the relevant CFG file for the data source:
MaxFetchArraySize = -1For the connected Web Client, navigate to Server Administration >Enterprise Configuration >Enterprise Profile Configuration >Component Profiles > ServerDataSrc. Set the DSMaxFetchArraySize parameter to -1.
To reduce the number of queries needed, you can use the parent-child relationships for business components that are set up in business objects. For example, an Opportunity business object sets up a parent-child relationship between the Opportunity business component and the Contact business component. If you query on the Opportunity business component you can read values from the corresponding records in the Contact business component without any additional queries. Before querying a child business component, you must query its parent, otherwise the query returns no records.
Used With
Server Script, Mobile/Dedicated Web Client Automation Server, COM Data Control, COM Data Server, Java Data Bean, CORBA Object Manager
Example
This Siebel VB example sets up and executes a query to find the primary on the account team. Only the primary can change the primary address. For other examples, read Applet_PreInvokeMethod, GotoView, and ClearToQuery.
(general) (declarations)
Option ExplicitFunction BusComp_PreSetFieldValue (FieldName As String,
FieldValue As String) As Integer
Dim iReturn As Integer, i As Integer
Dim iFoundP As Integer ' 1 = found (TRUE), 0 = not found (FALSE)
Dim oMVGBC as BusComp
iReturn = ContinueOperation
iFoundP = FALSESelect Case FieldName
Case "SSA Primary Field"
set oMVGBC = me.ParentBusComp.GetMVGBusComp("Sales Rep")
With oMVGBC ' this is the position BC
.ClearToQuery
.ActivateField "Active Login Name"
.ExecuteQuery ForwardBackward
i = .FirstRecord
Do While i <> 0
if .GetFieldValue("SSA Primary Field") = "Y" then
iFoundP = TRUE 'mark that found a primary
if.GetFieldValue("Active Login Name") <> _
TheApplication.LoginName then
RaiseErrorText"You cannot change the Primary address
because you are not the Primary on the Account Team")
iReturn = CancelOperation
end if
Exit Do
else
i = .NextRecord
end if
Loopif iFoundP = FALSE then
.FirstRecord
RaiseErrorText("No Primary Found - Contact an Administrator")
end if
End With
End Selectset oMVGBC = Nothing
BusComp_PreSetFieldValue = iReturn
End FunctionThis CORBA example looks up a customer name.
int customer::lookUp(char* fName, char* lName, SiebelApplication* pSeblApp)
{SiebelBusObject* pBusObj;
SiebelBusComp_ptr pBusComp;pBusObj = pSeblApp->GetBusObject("Contact");
pBusComp = pBusObj->GetBusComp("Contact");//Activate fields necessary for customer look-up
pBusComp->ActivateField("First Name");
pBusComp->ActivateField("Last Name");//Prepare BusComp for query, clear existing SearchSpecs
pBusComp->ClearToQuery();//Apply current SearchSpec
pBusComp->SetSearchSpec("Last Name", lName);
pBusComp->SetSearchSpec("First Name", fName);//Execute SearchSpec
pBusComp->ExecuteQuery(0);//If the contact is found, return a 1. Otherwise return a 0.
if (pBusComp->FirstRecord())
{
id = pBusComp->GetFieldValue("Id");
return 1;
}
else
{
return 0;
}}
See Also
Bookshelf Home | Contents | Index | Search | PDF |
Siebel Object Interfaces Reference Published: 18 June 2003 |