New (Record constructor)

From m204wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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