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

ExecuteQuery Method

ExecuteQuery returns a set of BusComp records using the criteria established with methods such as SetSearchSpec.


BusComp.ExecuteQuery ([cursorMode])



An integer. An optional argument that must be one of the following constants (provided in Siebel VB as well as COM Servers):

  • ForwardBackward. Selected records can be processed from first to last or from last to first. This is the default if no value is specified.
  • ForwardOnly. Selected records can be processed only from the first record to the last record. Focus cannot return to a record.

Not applicable


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

COM Data Control, COM Data Server, Java Data Bean, Mobile Web Client Automation Server, Server Script


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 Event, GotoView Method, and ClearToQuery Method.

(general) (declarations)
Option Explicit
Function 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 = FALSE
Select Case FieldName
Case "SSA Primary Field"
   set oMVGBC = me.ParentBusComp.GetMVGBusComp("Sales Rep")
   With oMVGBC ' this is the position BC
      .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
               TheApplication.RaiseErrorText"You cannot change the Primary address
               because you are not the Primary on the Account Team")
            iReturn = CancelOperation
         end if
      Exit Do
         i = .NextRecord
      end if
   if iFoundP = FALSE then
      TheApplication.RaiseErrorText("No Primary Found - Contact an Administrator")
   end if
   End With
End Select

set oMVGBC = Nothing
BusComp_PreSetFieldValue = iReturn

End Function

See Also

ClearToQuery Method
SetSearchSpec Method

Siebel Object Interfaces Reference