AddRecordsetNew (Recordset function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 1: Line 1:
<span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span>
{{Template:Recordset:AddRecordsetNew subtitle}}
[[Category:Recordset methods|AddRecordsetNew function]]
<p>
<var>AddRecordsetNew</var> is a member of the <var>[[Recordset class|Recordset]]</var> class.
</p>


<var>AddRecordsetNew</var> adds a <var>Recordset</var> object's records to the records in an existing
<var>AddRecordsetNew</var> adds a <var>Recordset</var> object's records to the records in an existing
Line 11: Line 7:
but produces a new output <var>Recordset</var> and leaves the two input <var>Recordsets</var> unmodified.
but produces a new output <var>Recordset</var> and leaves the two input <var>Recordsets</var> unmodified.
==Syntax==
==Syntax==
<p class="syntax">%target = %rs:AddRecordsetNew(recordsetObject)
{{Template:Recordset:AddRecordsetNew syntax}}
</p>
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
Line 25: Line 20:


</td></tr></table>
</td></tr></table>
==Usage Notes==
==Usage notes==
<ul>
<ul>
<li>The <var>AddRecordsetNew</var> method is only available in <var class="product">Sirius Mods</var> 7.1 and later.
<li>The <var>AddRecordsetNew</var> method is only available in <var class="product">Sirius Mods</var> 7.1 and later.
Line 33: Line 28:
must be greater than or equal to the lock strength of the set being added to.
must be greater than or equal to the lock strength of the set being added to.


Consequently, <var>AddRecordset</var> will not require any new locks &amp;mdash;
Consequently, <var>AddRecordset</var> will not require any new locks &amp;amp;mdash;
any records being added must already be locked by the user at an equal
any records being added must already be locked by the user at an equal
or greater strength than the target.
or greater strength than the target.
Line 82: Line 77:
Of course, identical processing could be done with an
Of course, identical processing could be done with an
<var>Or</var> in a <var>Find</var> statement.
<var>Or</var> in a <var>Find</var> statement.
==See also==
{{Template:Recordset:AddRecordsetNew footer}}

Revision as of 23:59, 14 April 2011

Combine two RecordSets to produce a third (Recordset class)


AddRecordsetNew adds a Recordset object's records to the records in an existing Recordset object, and produces a new Recordset object containing the combined records. It does the same processing as AddRecordset but produces a new output Recordset and leaves the two input Recordsets unmodified.

Syntax

%outRecordset = recordset:AddRecordsetNew( inRecordset2)

Syntax terms

%target The Recordset object variable created by this method.
%rs A non-null Recordset object, which must have the same file context as %target.
recordsetObject A non-null Recordset object, which must have the same file context as target and %rs.

Usage notes

  • The AddRecordsetNew method is only available in Sirius Mods 7.1 and later.
  • The LockStrength and LoopLockStrength of the output Recordset object is the same as that of the method object (%rs).
  • 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 &amp;mdash; 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 AddRecordsetNew method can be thought of as a Recordset OR operation; AndRecordsetNew can be thought of as an AND; and RemoveRecordsetNew 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 %both is object recordSet in file orders find records to %review status = 'REVIEW' end find find records to %pending status = 'PENDING' end find %both = %review:addRecordsetNew(%pending)

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

See also