RemoveRecord (Recordset subroutine): Difference between revisions
mNo edit summary |
No edit summary |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:Recordset:RemoveRecord subtitle}} | |||
<var>RemoveRecord</var> removes the record in a <var>Record</var> object from the records | <var>RemoveRecord</var> removes the record in a <var>Record</var> object from the records | ||
Line 10: | Line 6: | ||
<var class="product">User Language</var> <var>Remove Record</var> statement, but it does so for <var>Recordset</var> objects. | <var class="product">User Language</var> <var>Remove Record</var> statement, but it does so for <var>Recordset</var> objects. | ||
==Syntax== | ==Syntax== | ||
{{Template:Recordset:RemoveRecord syntax}} | |||
===Syntax | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><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> | ||
</td></tr></table> | <tr><th>record</th> | ||
==Usage | <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== | |||
<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. | ||
<li>Once a record has been removed from a recordset via RemoveRecord, the record data can no longer be accessed within the recordset context. | |||
</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 | |||
status = 'ACTIVE' | |||
end find | |||
for each record in %mailList | |||
if totalPurchase lt 100 then | |||
%mailList:removeRecord(currentRecord) | |||
end if | |||
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"> | <p class="code">%mailList:removeRecord( %(Record in File customers):currentRecord ) | ||
</p> | </p> | ||
==See also== | |||
{{Template:Recordset:RemoveRecord footer}} |
Latest revision as of 10:28, 10 September 2013
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.
- Once a record has been removed from a recordset via RemoveRecord, the record data can no longer be accessed within the recordset context.
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 )