AddRecord (Recordset subroutine): Difference between revisions

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




Line 12: Line 8:
but it does so for <var>Recordset</var> objects.
but it does so for <var>Recordset</var> objects.
==Syntax==
==Syntax==
<p class="syntax">%target:AddRecord(recordObject)
{{Template:Recordset:AddRecord 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>recordObject</th>
<tr><th>record</th>
<td>A non-null <var>Record</var> object, which must have the same file context as ''%target''.
<td>A non-null <var>Record</var> object, which must have the same file context as <var class="term">recordset</var>.


</td></tr></table>
</td></tr></table>
==Usage Notes==
==Usage notes==
<ul>
<ul>
<li>The lock strength of the <var>Record</var> object being added to the method object
<li>The lock strength of the <var>Record</var> object being added to the method object
Line 57: Line 52:
       %overPaid:addRecord(currentRecord)
       %overPaid:addRecord(currentRecord)
     end if
     end if
  end find
  end for
</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">       %overPaid:addRecord( -
<p class="code">%overPaid:addRecord( %(Record in File customers):currentRecord )
          %(Record in File customers):currentRecord)
</p>
</p>
==See also==
<ul>
<li><var>[[AddRecordset (Recordset subroutine)|AddRecordset]]</var>
<li><var>[[AddRecordsetNew (Recordset function)|AddRecordsetNew]]</var>
</ul>
{{Template:Recordset:AddRecord footer}}

Latest revision as of 13:40, 13 April 2015

Add Record object record to a Recordset (Recordset class)


AddRecord adds the record in a Record object to the records in an existing Recordset object. It provides functionality identical to the User Language Place Record statement, but it does so for Recordset objects.

Syntax

recordset:AddRecord( 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

  • The lock strength of the Record object being added to the method object must be greater than or equal to the lock strength of the record set being added to. Consequently, AddRecord does not require any new locks — the record being added must already be locked at an equal or greater strength than the target. Therefore, this method will never cause a record locking conflict. Within a Recordset, all records are always locked at the same strength (the lock strength with which the object was created). In summary, these locking rules are in effect. Any violation of them results in request cancellation.
    • To a Recordset locked at exclusive level, you may add only a record that is locked at exclusive level.
    • To a Recordset locked at share level, you may add a record locked at exclusive level or share level.
    • To an unlocked Recordset you may add a record locked at any strength (exclusive, share, none).
  • If the Record object parameter of AddRecord is null, the request is cancelled.

Example

In the following example, the records where field Paid is greater than field Charges are placed on a Recordset:

%overPaid is object recordSet in file customers %overpaid = new(share) for each record in file customers if paid gt charges then %overPaid:addRecord(currentRecord) end if end for

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:

%overPaid:addRecord( %(Record in File customers):currentRecord )

See also