RemoveRecord (Recordset subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 7: Line 7:
==Syntax==
==Syntax==
{{Template:Recordset:RemoveRecord syntax}}
{{Template:Recordset:RemoveRecord syntax}}
===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>recordObject</th>
<td>A non-null <var>Record</var> object, which must have the same file context as <code>%target</code>.


</td></tr></table>
<tr><th>record</th>
<td>A non-null <var>Record</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>Since <var>RemoveRecord</var> never adds a record to a <var>Recordset</var>, there are no lock
<li>Since <var>RemoveRecord</var> never adds a record 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.
<li>If the <var>Record</var> object argument of <var>RemoveRecord</var> is null, the request is cancelled.
<li>If the <var>Record</var> object argument of <var>RemoveRecord</var> is null, the request is cancelled.
</ul>
</ul>
==Example==
==Example==
In the following example, records not meeting
In the following example, records not meeting
a certain criterion are removed from a <var>Recordset</var>:
a certain criterion are removed from a <var>Recordset</var>:
<p class="code"> %mailList    is object recordSet in  file customers
<p class="code">%mailList    is object recordSet in  file customers
find records to %mailList
find records to %mailList
    status = 'ACTIVE'
  status = 'ACTIVE'
end find
end find


for each record in %mailList
for each record in %mailList
    if totalPurchase lt 100 then
  if totalPurchase lt 100 then
      %mailList:removeRecord(currentRecord)
      %mailList:removeRecord(currentRecord)
    end if
  end if
end find
end find
</p>
</p>
With version 6.8 of <var class="product">Sirius Mods</var> and earlier, you must specify the
With version 6.8 of <var class="product">Sirius Mods</var> and earlier, you must specify the
class name or an object variable before the <var>CurrentRecord</var> method name; for example:
class name or an object variable before the <var>CurrentRecord</var> method name; for example:
<p class="code">       %mailList:removeRecord( -
<p class="code">%mailList:removeRecord( %(Record in File customers):currentRecord )
          %(Record in File customers):currentRecord)
</p>
</p>
==See also==
==See also==
{{Template:Recordset:RemoveRecord footer}}
{{Template:Recordset:RemoveRecord footer}}

Revision as of 23:47, 6 November 2012

Remove Record object record from Recordset (Recordset class)


RemoveRecord removes the record in a Record object from the records in an existing Recordset object. It provides functionality identical to the User Language Remove Record statement, but it does so for Recordset objects.

Syntax

recordset:RemoveRecord( record)

Syntax terms

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

Usage notes

  • Since RemoveRecord never adds a record to a Recordset, there are no lock strength requirements for the method object or the input object.
  • If the Record object argument of RemoveRecord is null, the request is cancelled.

Example

In the following example, records not meeting a certain criterion are removed from a Recordset:

%mailList is object recordSet in file customers find records to %mailList status = 'ACTIVE' end find for each record in %mailList if totalPurchase lt 100 then %mailList:removeRecord(currentRecord) end if end find

With version 6.8 of Sirius Mods and earlier, you must specify the class name or an object variable before the CurrentRecord method name; for example:

%mailList:removeRecord( %(Record in File customers):currentRecord )

See also