AndRecordsetNew (Recordset function): Difference between revisions
m (1 revision) |
m (→Example) |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:Recordset:AndRecordsetNew subtitle}} | |||
<var>AndRecordsetNew</var> & | <var>AndRecordsetNew</var> “ANDs” a <var>Recordset</var> object's records with the records in an | ||
another <var>Recordset</var> object and produces a new <var>Recordset</var> object that contains the | another <var>Recordset</var> object and produces a new <var>Recordset</var> object that contains the | ||
records in both <var>Recordsets</var>. | records in both <var>Recordsets</var>. | ||
It does the same processing as <var>[[AndRecordset (Recordset subroutine)|AndRecordset]]</var>, | It does the same processing as <var>[[AndRecordset (Recordset subroutine)|AndRecordset]]</var>, | ||
but it produces a new output <var>Recordset</var> and leaves the two input <var>Recordsets</var> unmodified. | but it produces a new output <var>Recordset</var> and leaves the two input <var>Recordsets</var> unmodified. | ||
== | ==Syntax== | ||
{{Template:Recordset:AndRecordsetNew syntax}} | |||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>% | <tr><th>%outRecordset</th> | ||
<td>The <var>Recordset</var> object | <td>The <var>Recordset</var> object created by this method. | ||
</td></tr> | </td></tr> | ||
<tr><th> | <tr><th>recordset</th> | ||
<td>A non-null <var>Recordset</var> object, which must have the same file context as | <td>A non-null <var>Recordset</var> object, which must have the same file context as <var class="term">%outRecordset</var>. | ||
</td></tr> | </td></tr> | ||
<tr><th> | <tr><th>recordset2</th> | ||
<td>A non-null <var>Recordset</var> object, which must have the same file context as | <td>A non-null <var>Recordset</var> object, which must have the same file context as <var class="term">%outRecordset</var>. | ||
</td></tr></table> | </td></tr></table> | ||
==Usage | ==Usage notes== | ||
<ul> | <ul> | ||
<li>The <var>AndRecordsetNew</var> method is only available in <var class="product">Sirius Mods</var> 7.1 and later. | <li>The <var>AndRecordsetNew</var> method is only available in <var class="product">Sirius Mods</var> 7.1 and later. | ||
<li>The <var>LockStrength</var> and <var>LoopLockStrength</var> of the output Recordset object is | <li>The <var>LockStrength</var> and <var>LoopLockStrength</var> of the output Recordset object is | ||
the same as that of the method object | the same as that of the method object <var class="term">recordset</var>. | ||
<li>If the <var> | <li>If the <var class="term">recordset2</var> argument is null, the request is cancelled. | ||
cancelled. | |||
<li>Since <var>AndRecordsetNew</var> never adds records to a <var>Recordset</var>, there are no lock | <li>Since <var>AndRecordsetNew</var> never adds records to a <var>Recordset</var>, there are no lock | ||
strength requirements for either the method or input object. | strength requirements for either the method or input object. | ||
Line 37: | Line 31: | ||
<var>[[AddRecordsetNew (Recordset function)|AddRecordsetNew]]</var> can be thought of | <var>[[AddRecordsetNew (Recordset function)|AddRecordsetNew]]</var> can be thought of | ||
as an OR; and <var>[[RemoveRecordsetNew (Recordset function)|RemoveRecordsetNew]]</var> | as an OR; and <var>[[RemoveRecordsetNew (Recordset function)|RemoveRecordsetNew]]</var> | ||
as | as subtraction. | ||
No basic method is the analog of an exclusive OR operation, but | No basic method is the analog of an exclusive OR operation, but | ||
you can use the basic methods to achieve | you can use the basic methods to achieve an exclusive OR, as shown | ||
in | in the [[RemoveRecordsetNew (Recordset function)#Examples|"Examples"]] section of <var>RemoveRecordsetNew</var>. | ||
</ul> | </ul> | ||
Line 49: | Line 43: | ||
Of course, identical processing could be better done with an | Of course, identical processing could be better done with an | ||
<var>And</var> in a <var>Find</var> statement. | <var>And</var> in a <var>Find</var> statement. | ||
<p class="code"> %review is object recordSet in file orders | <p class="code">%review is object recordSet in file orders | ||
%bigCust is object recordSet in file orders | |||
%bigReview is object recordSet in file orders | |||
find records to %review | |||
status = 'REVIEW' | |||
end find | |||
find records to %bigCust | |||
company ='TOXICO' | |||
end find | |||
%bigReview = %review:andRecordsetNew(%bigCust) | |||
</p> | </p> | ||
==See also== | |||
<ul> | |||
<li><var>[[AndRecordset (Recordset subroutine)|AndRecordset]]</var> | |||
</ul> | |||
{{Template:Recordset:AndRecordsetNew footer}} |
Latest revision as of 22:25, 6 November 2012
Create new Recordset from intersection of two Recordsets (Recordset class)
AndRecordsetNew “ANDs” a Recordset object's records with the records in an
another Recordset object and produces a new Recordset object that contains the
records in both Recordsets.
It does the same processing as AndRecordset,
but it produces a new output Recordset and leaves the two input Recordsets unmodified.
Syntax
%outRecordset = recordset:AndRecordsetNew( recordset2)
Syntax terms
%outRecordset | The Recordset object created by this method. |
---|---|
recordset | A non-null Recordset object, which must have the same file context as %outRecordset. |
recordset2 | A non-null Recordset object, which must have the same file context as %outRecordset. |
Usage notes
- The AndRecordsetNew 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 recordset.
- If the recordset2 argument is null, the request is cancelled.
- Since AndRecordsetNew never adds records to a Recordset, there are no lock strength requirements for either the method or input object.
- The AndRecordsetNew method can be thought of as a Recordset AND operation; AddRecordsetNew can be thought of as an OR; and RemoveRecordsetNew as subtraction. No basic method is the analog of an exclusive OR operation, but you can use the basic methods to achieve an exclusive OR, as shown in the "Examples" section of RemoveRecordsetNew.
Example
In the following example, the result of one Find is used to limit the result of another Find. Of course, identical processing could be better done with an And in a Find statement.
%review is object recordSet in file orders %bigCust is object recordSet in file orders %bigReview is object recordSet in file orders find records to %review status = 'REVIEW' end find find records to %bigCust company ='TOXICO' end find %bigReview = %review:andRecordsetNew(%bigCust)