AddRecordset (Recordset subroutine)

From m204wiki
Revision as of 19:30, 12 April 2011 by Admin (talk | contribs) (1 revision)
Jump to navigation Jump to search

<section begin=dpl_desc/><section end=dpl_desc/>

AddRecordset is a member of the Recordset class.

AddRecordset adds a Recordset object's records to the records in an existing Recordset object. It provides functionality identical to the User Language Place Records statement, but it does so for Recordset objects.

Syntax

%target:AddRecordset(recordsetObject)

Syntax Terms

%target A non-null Recordset object variable.
recordsetObject A non-null Recordset object, which must have the same file context as %target.

Usage Notes

  • The lock strength of the Recordset object being added to the method object must be greater than or equal to the lock strength of the set being added to. Consequently, AddRecordset will not require any new locks — any records being added must already be locked by the user at an equal or greater strength than the target. Therefore, this method will never cause a record locking conflict. Within a Recordset, all records are always locked at the same strength (the lock strength with which the object was created). In summary, these locking rules are in effect. Any violation of them results in request cancellation.
    • To a Recordset locked at exclusive level, you may add only records that are locked at exclusive level.
    • To a Recordset locked at share level, you may add records locked at exclusive level or share level.
    • To an unlocked Recordset you may add records locked at any strength (exclusive, share, none).
  • If the Recordset object parameter of AddRecordset is null, the request is cancelled.
  • The AddRecordset method can be thought of as a Recordset OR operation; AndRecordset can be thought of as an AND; and RemoveRecordset as a NOT. No basic method is the analog of an exclusive OR operation, but you can use the basic methods to achieve such an OR, as shown in "Examples".

Example

In the following example, the result of one Find is combined with the result of another:

%review is object recordSet in file orders %pending is object recordSet in file orders find records to %review status = 'REVIEW' end find find records to %pending status = 'PENDING' end find %review:addRecordset(%pending)

Of course, identical processing could be done with an Or in a Find statement.