AndRecordset (Recordset subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span>
{{Template:Recordset:AndRecordset subtitle}}
[[Category:Recordset methods|AndRecordset subroutine]]
<p>
<var>AndRecordset</var> is a member of the <var>[[Recordset class|Recordset]]</var> class.
</p>


<var>AndRecordset</var> &amp;ldquo;ANDs&amp;rdquo; a <var>Recordset</var> object's records with the records in an
<var>AndRecordset</var> "ANDs" a <var>Recordset</var> object's records with the records in a
existing <var>Recordset</var> object: that is, it removes records from the
second <var>Recordset</var> object: that is, it removes records from the
method <var>Recordset</var> object that are not also on the input <var>Recordset</var> object.
method <var>Recordset</var> object that are not also on the second <var>Recordset</var> object.
==Syntax==
==Syntax==
<p class="syntax">%target:AndRecordset(recordsetObject)
{{Template:Recordset:AndRecordset syntax}}
</p>
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%target</th>
<tr><th>recordset</th>
<td>A non-null <var>Recordset</var> object variable.
<td>A non-null <var>Recordset</var> object variable.
</td></tr>
</td></tr>
<tr><th>recordsetObject</th>
<tr><th>recordset2</th>
<td>A non-null <var>Recordset</var> object, which must have the same file context as ''%target''.
<td>A non-null <var>Recordset</var> object, which must have the same file context as the method object <var class="term">recordset</var>.


</td></tr></table>
</td></tr></table>
==Usage Notes==
==Usage notes==
<ul>
<ul>
<li>If the <var>Recordset</var> object argument of <var>AndRecordset</var> is null, the request is
<li>If the <var class="term">recordset2</var> argument is null, the request is cancelled.
cancelled.
 
<li>Since <var>AndRecordset</var> never adds records to a <var>Recordset</var>, there are no lock
<li>Since <var>AndRecordset</var> never adds records to a <var>Recordset</var>, there are no lock
strength requirements for either the method or input objects.
strength requirements for either the method or input objects.
<li>The <var>AndRecordset</var> method can be thought of as a <var>Recordset</var> AND operation;
<li>The <var>AndRecordset</var> method can be thought of as a <var>Recordset</var> AND operation;
<var>[[AddRecordset (Recordset subroutine)|AddRecordset]]</var> can be thought of
<var>[[AddRecordset (Recordset subroutine)|AddRecordset]]</var> can be thought of
as an OR; and <var>[[RemoveRecordset (Recordset subroutine)|RemoveRecordset]]</var>
as an OR; and <var>[[RemoveRecordset (Recordset subroutine)|RemoveRecordset]]</var>
as a NOT.
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 such an OR, as shown
you can use the basic methods to achieve an exclusive OR, as shown
in <var>[[RemoveRecordset (Recordset subroutine)#Examples|"Examples"]]</var>.
in the <var>RemoveRecordset</var> [[RemoveRecordset (Recordset subroutine)#Examples|"Examples"]] section.
</ul>
</ul>
==Example==
==Example==


Line 40: Line 37:
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
%bigCust    is object recordSet in  file orders


find records to %review
find records to %review
    status = 'REVIEW'
  status = 'REVIEW'
end find
end find


find records to %bigCust
find records to %bigCust
    company ='TOXICO'
  company ='TOXICO'
end find
end find


%review:andRecordset(%bigCust)
%review:andRecordset(%bigCust)
</p>
</p>
==See also==
<ul>
<li><var>[[AndRecordsetNew (Recordset function)|AndRecordsetNew]]</var>
</ul>
{{Template:Recordset:AndRecordset footer}}

Latest revision as of 22:24, 6 November 2012

Merge two Recordsets to form their logical intersection (Recordset class)


AndRecordset "ANDs" a Recordset object's records with the records in a second Recordset object: that is, it removes records from the method Recordset object that are not also on the second Recordset object.

Syntax

recordset:AndRecordset( recordset2)

Syntax terms

recordset A non-null Recordset object variable.
recordset2 A non-null Recordset object, which must have the same file context as the method object recordset.

Usage notes

  • If the recordset2 argument is null, the request is cancelled.
  • Since AndRecordset never adds records to a Recordset, there are no lock strength requirements for either the method or input objects.
  • The AndRecordset method can be thought of as a Recordset AND operation; AddRecordset can be thought of as an OR; and RemoveRecordset 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 RemoveRecordset "Examples" section.

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 find records to %review status = 'REVIEW' end find find records to %bigCust company ='TOXICO' end find %review:andRecordset(%bigCust)

See also