New (Record constructor): Difference between revisions
mNo edit summary |
mNo edit summary |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:Record:New subtitle}} | {{Template:Record:New subtitle}} | ||
This method has one required parameter if in file context, two required parameters if in group context, and two optional parameters in either context. The parameters are applied by the <var>New</var> constructor to the newly instantiated object. | |||
==Syntax== | ==Syntax== | ||
{{Template:Record:file:New syntax}} | {{Template:Record:file:New syntax}} | ||
{{Template:Record:group:New syntax}} | {{Template:Record:group:New syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%fileRecord</th> | |||
<td>A <var>Record</var> object variable declared in file context.</td></tr> | |||
<tr><th>%groupRecord</th> | <tr><th>%groupRecord</th> | ||
<td>A | <td>A <var>Record</var> object variable declared in group context.</td></tr> | ||
</td></tr> | |||
<tr><th nowrap="true"><var>[%(Record In <i>filOrGrp name</i>)]</var></th> | |||
<td>The optional class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|"Usage notes"]], below, for more information about invoking a <var>Record</var> <var>Constructor</var>.</td></tr> | |||
<tr><th>number</th> | <tr><th>number</th> | ||
<td>The number of the record to which the instantiated <var>Record</var> object will refer. | <td>The number of the record to which the instantiated <var>Record</var> object will refer.</td></tr> | ||
</td></tr> | |||
<tr><th>string</th> | <tr><th>string</th> | ||
<td>For group context, the name of the file that contains the record that the instantiated <var>Record</var> object will reference. | <td>For group context, the name of the file that contains the record that the instantiated <var>Record</var> object will reference. | ||
</td></tr> | </td></tr> | ||
<tr><th>lockstrength</th> | <tr><th>lockstrength</th> | ||
<td>The | <td>The strength of the lock to be used for the record referenced by the object. This value is a <var>[[LockStrength_enumeration|LockStrength enumeration]]</var> value: <var>None</var>, <var>Share</var>, or <var>Exclusive</var>. | ||
</td></tr> | |||
This is an optional parameter, and it defaults to <var>Share</var>.</td></tr> | |||
<tr><th><var>LoopLockStrength</var></th> | <tr><th><var>LoopLockStrength</var></th> | ||
<td>The lock strength to be used for <var>For Record</var> loops on the <var>Record</var> object. This is an optional, name required, parameter, and it defaults to <var>None</var>. See [[Record class#LoopLockStrength for Records|"LoopLockStrength for Records"]]. This parameter is available under <var class="product">Sirius Mods</var> 7.0 and later. | <td>The lock strength to be used for <var>For Record</var> loops on the <var>Record</var> object. This is an optional, name required, parameter, and it defaults to <var>None</var>. See [[Record class#LoopLockStrength for Records|"LoopLockStrength for Records"]]. This parameter is available under <var class="product">Sirius Mods</var> 7.0 and later.</td></tr> | ||
</table> | |||
</td></tr></table> | |||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li><var>New</var> | <li>As described in [[Object variables#Using New or other Constructors|"Using New or other Constructors"]], <var>New</var> can be invoked with no object, with an explicit class specification, or with an object variable in the class, even if that object is <var>Null</var>: | ||
explicit class | <p class="code">%rec = new(share) | ||
<p class="code"> %rec = new(share) | |||
%rec = %(Record in file sirLocal):new(exclusive) | |||
%rec = %rec:new(none) | |||
</p> | </p> | ||
'''Note:''' | |||
As shown above, when explicitly indicating the | |||
class, both the class name and the file or group context must be | |||
specified just as they are on the <var>Record</var> variable's declaration. | |||
<li>The <var>[[LockStrength (Record function)|LockStrength]]</var> returns the locking | <li>The <var>[[LockStrength (Record function)|LockStrength]]</var> returns the locking | ||
level of a <var>Record</var> object. | level of a <var>Record</var> object. | ||
<li> | <li><var>New</var> is not the only way to instantiate a <var>Record</var> object. See | ||
[[Record class#Instantiating Record objects|"Instantiating Record objects"]]. | |||
< | |||
[[Record class# | |||
</ul> | </ul> | ||
==See also== | ==See also== | ||
{{Template:Record:New footer}} | {{Template:Record:New footer}} |
Latest revision as of 01:36, 8 November 2012
Create a new Record object (Record class)
This method has one required parameter if in file context, two required parameters if in group context, and two optional parameters in either context. The parameters are applied by the New constructor to the newly instantiated object.
Syntax
%fileRecord = [%(Record In filOrGrp name):]New( number, [lockStrength], - [LoopLockStrength= lockStrength]) Throws RecordLockingConflict
%groupRecord = [%(Record In filOrGrp name):]New( number, string, - [lockStrength], - [LoopLockStrength= lockStrength]) Throws RecordLockingConflict
Syntax terms
%fileRecord | A Record object variable declared in file context. |
---|---|
%groupRecord | A Record object variable declared in group context. |
[%(Record In filOrGrp name)] | The optional class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a Record Constructor. |
number | The number of the record to which the instantiated Record object will refer. |
string | For group context, the name of the file that contains the record that the instantiated Record object will reference. |
lockstrength | The strength of the lock to be used for the record referenced by the object. This value is a LockStrength enumeration value: None, Share, or Exclusive. This is an optional parameter, and it defaults to Share. |
LoopLockStrength | The lock strength to be used for For Record loops on the Record object. This is an optional, name required, parameter, and it defaults to None. See "LoopLockStrength for Records". This parameter is available under Sirius Mods 7.0 and later. |
Usage notes
- As described in "Using New or other Constructors", New can be invoked with no object, with an explicit class specification, or with an object variable in the class, even if that object is Null:
%rec = new(share) %rec = %(Record in file sirLocal):new(exclusive) %rec = %rec:new(none)
Note: As shown above, when explicitly indicating the class, both the class name and the file or group context must be specified just as they are on the Record variable's declaration.
- The LockStrength returns the locking level of a Record object.
- New is not the only way to instantiate a Record object. See "Instantiating Record objects".