New (Record constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Template:Record:New subtitle}}
{{Template:Record:New subtitle}}
This shared function 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.
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>
<tr><th>%fileRecord</th>
<td>A declared <var>Record</var> object variable in file context.
<td>A <var>Record</var> object variable declared in file context.</td></tr>
</td></tr>
 
<tr><th>%groupRecord</th>
<tr><th>%groupRecord</th>
<td>A declared <var>Record</var> object variable in group context.
<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>
<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>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>
</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 strength of the lock to be used for the record referenced by the object. This value is a [[LockStrength_enumeration|LockStrength enumeration]] value: <var>None</var>, <var>Share</var>, or <var>Exclusive</var>.
<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==

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".

See also