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

ExecuteQuery Method


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

Syntax

BusComp.ExecuteQuery ([cursorMode])

Argument
Description

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

NOTE:  You must activate fields by using the ActivateField method before executing a query for a business component. If you are writing an event handler on a business component, you must make sure that the field has already been activated by specifying the ForceActive user property on the control.

Used With

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

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

(general)
(declarations)
Option Explicit
Function BusComp_PreSetFieldValue (FieldName As String,
FieldValue As String) As Integer
Dim i As Integer
Dim iFoundP As Integer ' 1 = found (TRUE), 0 = not found (FALSE)
Dim oMVGBC as BusComp

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"
      .ActivateField "SSA Primary Field"
      .ClearToQuery
      .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")
         End If
      Exit Do
      Loop
   If iFoundP = FALSE Then
      .FirstRecord
      TheApplication.RaiseErrorText("No Primary Found - Contact an Administrator")
   End If
   End With
End Select

Set oMVGBC = Nothing
BusComp_PreSetFieldValue = ContinueOperation

End Function

Related Topics

ActivateField Method
ClearToQuery Method
SetSearchSpec Method

Siebel Object Interfaces Reference Copyright © 2008, Oracle. All rights reserved.