Skip to main content
  1. Posts/

Cursor modes in Siebel Queries

·2 mins

Siebel provides two cursor modes that can be employed for different purposes - unidirectional and bidirectional queries. The mode does not denote how Siebel queries for the record, but more on how the application traverses through the result set.

When a user goes to a specific screen/view and queries for a record, Siebel uses a bidirectional query in the backend. This does not have any implication on the generated SQL. The application internally maintains a cursor to determine active record and current record set.

Scripting #

Cursor mode is more visible in scripting.

with (bcOpty) {
    SetViewMode (AllView);
    SetSearchSpec("Id", sId);
    ExecuteQuery(ForwardOnly);
    iIsRecord = FirstRecord();
 }

The ExecuteQuery statement specifies how Siebel will processes the records -

  • ForwardOnly: go in forward direction - One record at a time from beginning through the end
  • ForwardBackward: Process one record at a time either in the forward direction or in the reverse

We are told that ForwardOnly improves the performance. You can also process result set of more than 10,000 records in  this mode. On the flipside, you cannot use PreviousRecord() or FirstRecord() while processing the end recorded the result set.

ForwardBackward is a more versatile option since it allows processing in both directions. It is slower, and if there are more than 10,000 records in the result set the query will return an error -

There were more rows than could be returned. Refine your query to bring back fewer rows.

ForwardBackward also filters out the duplicate records. For example if you have an incorrect joy that will result in the same record being returned more than once, ForwardBackward will show only the unique records.

ForwardBackward is the recommended query mode on UI.

You could control the number of records returned in ForwardBackward mode as well, but using a different method called “ExecuteQuery2”.

[BusComp].ExecuteQuery2 ([cursorMode], ignoreMaxCursorSize)

ignoreMaxCursorSize can be TRUE or FALSE. While “TRUE” has similar behaviour as ExecuteQuery method, a value of “FALSE” will instruct application to consider a parameter called “MaxCursorSize” in the CFG file. You can specify a value against this parameter to restrict the number of records in the result set.

Workflows #

You can specify the unidirectional or bidirectional query in Siebel Operation step.

cursor modes that can be used in query step in workflows

The arguments behave similar to their scripting counterparts.