RemoveRecordsetNew (Recordset function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with " <span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span> RemoveRecordsetNew function <p> <var>RemoveRecordsetNew</var> i...")
 
mNo edit summary
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Template:Recordset:RemoveRecordsetNew subtitle}}


<span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span>
<var>RemoveRecordsetNew</var> "subtracts", from a <var>Recordset</var> object's records, the records
[[Category:Recordset methods|RemoveRecordsetNew function]]
in a second <var>Recordset</var> object, producing a new <var>Recordset</var> object that
<p>
contains all the records in the first <var>Recordset</var>, but not the second. It does the same processing as <var>[[RemoveRecordset (Recordset subroutine)|RemoveRecordset]]</var>, but it produces a new output <var>Recordset</var> and leaves the two input <var>Recordset</var>s unmodified.
<var>RemoveRecordsetNew</var> is a member of the <var>[[Recordset class|Recordset]]</var> class.
</p>


<var>RemoveRecordsetNew</var> &ldquo;NOTs&rdquo; a <var>Recordset</var> object's records with the records
in an existing <var>Recordset</var> object and produces a new <var>Recordset</var> object that
contains all the records in the first <var>Recordset</var>, but not the second.
That is, it removes records from the method <var>Recordset</var> object
that are in the input <var>Recordset</var> object.
==Syntax==
==Syntax==
<p class="syntax">%target = %rs:RemoveRecordsetNew(recordsetObject)
{{Template:Recordset:RemoveRecordsetNew syntax}}
</p>
 
===Syntax Terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%target</th>
<tr><th>%outRecordset</th>
<td>The <var>Recordset</var> object variable created by this method.
<td>The <var>Recordset</var> object created by this method.</td></tr>
</td></tr>
 
<tr><th>%rs</th>
<tr><th>recordset</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 <var class="term">%outRecordset</var>.</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'' and ''%rs''.
<td>A non-null <var>Recordset</var> object, which must have the same file context as <var class="term">%outRecordset</var> and the method object, <var class="term">recordset</var>.</td></tr>
</td></tr></table>
</table>
==Usage Notes==
 
==Usage notes==
<ul>
<ul>
<li>The <var>RemoveRecordsetNew</var> method is only available in <var class="product">Sirius Mods</var> 7.1 and later.
<li>The <var>RemoveRecordsetNew</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 <var>Recordset</var> object is
<li>The <var>LockStrength</var> and <var>LoopLockStrength</var> of the output <var>Recordset</var> object is
the same as that of the method object (''%rs'').
the same as that of the method object, <var class="term">recordset</var>.
<li>If the <var>Recordset</var> object argument of <var>RemoveRecordsetNew</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>RemoveRecordsetNew</var> never adds records to a <var>Recordset</var>, there are no lock
<li>Since <var>RemoveRecordsetNew</var> never adds records to a <var>Recordset</var>, there are no lock
strength requirements for the either method or input object.
strength requirements for either the method or input object.
</ul>
</ul>
==Examples==
==Examples==
<ul>
<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"> %arrears    is object recordSet in  file orders
<p class="code">%arrears    is object recordSet in  file orders
%bigCust    is object recordSet in  file orders
%bigCust    is object recordSet in  file orders
%threaten    is object recordSet in  file orders
%threaten    is object recordSet in  file orders


find records to %arrears
find records to %arrears
    status = 'ARREARS'
  status = 'ARREARS'
end find
end find


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


%threaten = %arrears:removeRecordset(%bigCust)
%threaten = %arrears:removeRecordset(%bigCust)
</p>
</p>
<li><var>RemoveRecordsetNew</var> can be thought of as a NOT operation,
 
<li><var>RemoveRecordsetNew</var> can be thought of as subtraction,
<var>[[AddRecordsetNew (Recordset function)|AddRecordsetNew]]</var> as an
<var>[[AddRecordsetNew (Recordset function)|AddRecordsetNew]]</var> as an
OR, and <var>[[AndRecordsetNew (Recordset function)|AndRecordsetNew]]</var> as an AND.
OR, and <var>[[AndRecordsetNew (Recordset function)|AndRecordsetNew]]</var> as an AND.
Line 62: Line 62:
However, you can achieve such an exclusive OR operation with the
However, you can achieve such 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
%second      is object recordSet in foo
%xor        is object recordSet in foo
%xor        is object recordSet in foo
  ...
...
%xor  = %first:addRecordsetNew(%second): -
%xor  = %first:addRecordsetNew(%second): -
        removeRecordset(%first:andRecordsetNew(%second))
        removeRecordset(%first:andRecordsetNew(%second))
</p>
</p>
And <code>%xor</code> is now the exclusive OR of the original <code>%first</code>
And <code>%xor</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>[[RemoveRecordset (Recordset subroutine)|RemoveRecordset]]</var>
</ul>
</ul>
{{Template:Recordset:RemoveRecordsetNew footer}}

Latest revision as of 23:56, 6 November 2012

Create Recordset from all records in one Recordset that are not in another (Recordset class)


RemoveRecordsetNew "subtracts", from a Recordset object's records, the records in a second Recordset object, producing a new Recordset object that contains all the records in the first Recordset, but not the second. It does the same processing as RemoveRecordset, but it produces a new output Recordset and leaves the two input Recordsets unmodified.

Syntax

%outRecordset = recordset:RemoveRecordsetNew( 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 and the method object, recordset.

Usage notes

  • The RemoveRecordsetNew 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 RemoveRecordsetNew never adds records to a Recordset, there are no lock strength requirements for either the method or input object.

Examples

  1. In the following example, the result of one Find is used to eliminate records from the result of another Find.

    %arrears is object recordSet in file orders %bigCust is object recordSet in file orders %threaten is object recordSet in file orders find records to %arrears status = 'ARREARS' end find find records to %bigCust company ='TOXICO' end find %threaten = %arrears:removeRecordset(%bigCust)

  2. RemoveRecordsetNew can be thought of as subtraction, AddRecordsetNew as an OR, and AndRecordsetNew 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 such 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 %xor is object recordSet in foo ... %xor = %first:addRecordsetNew(%second): - removeRecordset(%first:andRecordsetNew(%second))

    And %xor is now the exclusive OR of the original %first and %second.

See also