RemoveRecordset (Recordset subroutine): Difference between revisions
m (1 revision) |
m (→Examples) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:Recordset:RemoveRecordset subtitle}} | {{Template:Recordset:RemoveRecordset subtitle}} | ||
<var>RemoveRecordset</var> | <var>RemoveRecordset</var> removes or "subtracts," from the method <var>Recordset</var> object's records, the records | ||
in | in a second <var>Recordset</var> object. | ||
==Syntax== | ==Syntax== | ||
{{Template:Recordset:RemoveRecordset syntax}} | {{Template:Recordset:RemoveRecordset syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th> | <tr><th>recordset</th> | ||
<td>A non-null <var>Recordset</var> object | <td>A non-null <var>Recordset</var> object.</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">recordset</var>.</td></tr> | ||
</table> | |||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>If the <var> | <li>If the <var class="term">recordset2</var> argument is null, the request is cancelled. | ||
cancelled. | |||
<li>Since <var>RemoveRecordset</var> never adds records to a <var>Recordset</var>, there are no lock | <li>Since <var>RemoveRecordset</var> never adds records to a <var>Recordset</var>, there are no lock | ||
strength requirements for the method object or the input object. | strength requirements for the method object or the input object. | ||
</ul> | </ul> | ||
==Examples== | ==Examples== | ||
< | <ol> | ||
<li>In the following example, the result of one <var>Find</var> is used to eliminate records | <li>In the following example, the result of one <var>Find</var> is used to eliminate records | ||
from the result of another <var>Find</var>. | from the result of another <var>Find</var>. | ||
<p class="code"> %threaten is object recordSet in file orders | <p class="code">%threaten is object recordSet in file orders | ||
%bigCust is object recordSet in file orders | |||
find records to %threaten | |||
status = 'ARREARS' | |||
end find | |||
find records to %bigCust | |||
company ='TOXICO' | |||
end find | |||
%threaten:removeRecordset(%bigCust) | |||
</p> | </p> | ||
<li><var>RemoveRecordset</var> can be thought of as | |||
<li><var>RemoveRecordset</var> can be thought of as subtraction, | |||
<var>[[AddRecordset (Recordset subroutine)|AddRecordset]]</var> as an | <var>[[AddRecordset (Recordset subroutine)|AddRecordset]]</var> as an | ||
OR, and <var>[[AndRecordset (Recordset subroutine)|AndRecordset]]</var> as an AND. | OR, and <var>[[AndRecordset (Recordset subroutine)|AndRecordset]]</var> as an AND. | ||
Line 47: | Line 49: | ||
be rarely needed. | be rarely needed. | ||
However, you can achieve | However, you can achieve an exclusive OR operation with the | ||
provided methods, as in the following example: | provided methods, as in the following example: | ||
<p class="code"> %first is object recordSet in foo | <p class="code">%first is object recordSet in foo | ||
%second is object recordSet in foo | |||
%both is object recordSet in foo | |||
... | |||
%both = %first:copy | |||
%both:andRecordset(%second) | |||
%first:addRecordset(%second) | |||
%first:removeRecordset(%both) | |||
</p> | </p> | ||
And <code>%first</code> is now the exclusive OR of the original <code>%first</code> | And <code>%first</code> is now the exclusive OR of the original <code>%first</code> | ||
and <code>%second</code>. | and <code>%second</code>. | ||
</ol> | |||
==See also== | |||
<ul> | |||
<li><var>[[RemoveRecordsetNew (Recordset function)|RemoveRecordsetNew]]</var> | |||
</ul> | </ul> | ||
{{Template:Recordset:RemoveRecordset footer}} | {{Template:Recordset:RemoveRecordset footer}} |
Latest revision as of 23:51, 6 November 2012
Remove from a Recordset the records that are matched in input Recordset (Recordset class)
RemoveRecordset removes or "subtracts," from the method Recordset object's records, the records
in a second Recordset object.
Syntax
recordset:RemoveRecordset( recordset2)
Syntax terms
recordset | A non-null Recordset object. |
---|---|
recordset2 | A non-null Recordset object, which must have the same file context as recordset. |
Usage notes
- If the recordset2 argument is null, the request is cancelled.
- Since RemoveRecordset never adds records to a Recordset, there are no lock strength requirements for the method object or the input object.
Examples
- In the following example, the result of one Find is used to eliminate records
from the result of another Find.
%threaten is object recordSet in file orders %bigCust is object recordSet in file orders find records to %threaten status = 'ARREARS' end find find records to %bigCust company ='TOXICO' end find %threaten:removeRecordset(%bigCust)
- RemoveRecordset can be thought of as subtraction,
AddRecordset as an
OR, and AndRecordset as an AND.
The missing basic logical operation is an exclusive OR, which
is not implemented as a basic method because it is expected to
be rarely needed.
However, you can achieve an exclusive OR operation with the
provided methods, as in the following example:
%first is object recordSet in foo %second is object recordSet in foo %both is object recordSet in foo ... %both = %first:copy %both:andRecordset(%second) %first:addRecordset(%second) %first:removeRecordset(%both)
And
%first
is now the exclusive OR of the original%first
and%second
.