New (Record constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 6: Line 6:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%fileRecord</th>
<td>A declared <var>Record</var> object variable in file context.
</td></tr>
<tr><th>%groupRecord</th>
<tr><th>%groupRecord</th>
<td>A declared <var>Record</var> object variable in group context.
<td>A declared <var>Record</var> object variable in group context.
Line 37: Line 40:
'''Note:'''
'''Note:'''
As shown above, when explicitly indicating the
As shown above, when explicitly indicating the
class, both the class name and the file context must be
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.
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>For more information about constructors,
<li><var>New</var> is not the only way to instantiate a <var>Record</var> object. See
see [[Object variables#Creating object instances|"Creating object instances"]]
[[Record class#Instantiating Record objects|"Instantiating Record objects"]].
<li>For more information about using <var>New</var>, see
[[Record class#Using New to instantiate a Record object|"Using New to instantiate a Record object"]].
</ul>
</ul>
==See also==
==See also==
{{Template:Record:New footer}}
{{Template:Record:New footer}}

Revision as of 01:30, 27 July 2011

Create a new Record object (Record class)

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 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 declared Record object variable in file context.
%groupRecord A declared Record object variable in group context.
%(Record) The optional class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a Recordset 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 value of a Lockstrength enumeration: None, Share, or Exclusive. These correspond to standard Model 204 record-locking levels, as described below. The default lock strength of the new record object is Share, matching the locking behavior of a User Language For Record Number statement.
None
Record is not locked.
No locks are held on the object, so there is no conflict with others holding Share or Exclusive locks (readers and updaters may proceed).
Share
Record is share locked.
This level allows other users to hold a Share lock, but not an Exclusive lock (allows readers but not updaters to proceed).
Exclusive
Record is exclusively locked.
This level prohibits others from holding either an Exclusive lock or a Share lock. It is generally used for update.
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 name, 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