New (SortedRecordset constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template:SortedRecordset:New subtitle}}
{{Template:SortedRecordset:New subtitle}}


This shared function instantiates an empty instance of a <var>SortedRecordset</var> object.
This <var>Constructor</var> instantiates an empty instance of a <var>SortedRecordset</var> object.


Available as of <var class="product">Sirius Mods</var> version 7.6, the <var>New</var> method is an alternative
Available as of <var class="product">Sirius Mods</var> version 7.6, the <var>New</var> method is an alternative
to using a <var>Sort</var> statement factory constructor, as described
to using a <var>Sort</var> statement factory constructor, as described
in [[RecordsetCursor#Declaration and instantiation|"Declaration and instantiation"]].
in [[RecordsetCursor class#Declaration and instantiation|"Declaration and instantiation"]].
==Syntax==
==Syntax==
{{Template:SortedRecordset:New syntax}}
{{Template:SortedRecordset:New syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%srecs</th>
<tr><th>%sortedRecordset</th>
<td>A declared <var>SortedRecordset</var> object including its file/group context.
<td>A declared <var>SortedRecordset</var> object including its file/group context.</td></tr>
</td></tr>
 
<tr><th>class</th>
<tr><th nowrap="true"><var>[%(SortedRecordset In </var>filOrGrp name<var>):]</var></th>
<td>Either a parenthesized class name, as in <code>%(SortedRecordset in file foo</code>), or a non-parenthesized variable in the class, as in <var class="term">%srecs</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>SortedRecordset</var> <var>Constructor</var>.</td></tr>
</table>


</td></tr></table>
==Usage notes==
==Usage notes==
<ul>
<ul>
<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>:
<p class="code">%srecs = new
%srecs = %(SortedRecordset in file sirLocal):new
%srecs = %srecs:new
</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>SortedRecordset</var> variable's declaration.
<li>If you are creating an extension class of the <var>SortedRecordset</var> class,
<li>If you are creating an extension class of the <var>SortedRecordset</var> class,
you can use <var>New</var> in the <var>Construct</var> statement in the extension class:
you can use <var>New</var> in the <var>Construct</var> statement in the extension class:
<p class="code"> class sordidSet extends sortedRecordset in sordid inherit
<p class="code">class sordidSet extends sortedRecordset in sordid inherit
    ...
    ...
    constructor new
    constructor new
        construct %(sortedRecordset in sordid):new
      construct %(sortedRecordset in sordid):new
        ...
      ...
    end constructor
    end constructor
    ...
    ...
end class
end class
</p>
</p>


Line 35: Line 46:


==Example==
==Example==
<ul>
The <var>New</var> constructor has no parameters and simply
<li>The <var>New</var> constructor has no parameters and simply
instantiates an empty instance of its class:
instantiates an empty instance of its class:
<p class="code"> %srs  is object <var>SortedRecordset</var> in sordid
<p class="code">%srs  is object <var>SortedRecordset</var> in sordid
  ...
...
%srs = new
%srs = new
</p>
</p>
</ul>
 
==See also==
==See also==
{{Template:SortedRecordset:New footer}}
{{Template:SortedRecordset:New footer}}

Latest revision as of 15:33, 11 November 2012

Create a new SortedRecordset object (SortedRecordset class)


This Constructor instantiates an empty instance of a SortedRecordset object.

Available as of Sirius Mods version 7.6, the New method is an alternative to using a Sort statement factory constructor, as described in "Declaration and instantiation".

Syntax

%sortedRecordset = [%(SortedRecordset In filOrGrp name):]New

Syntax terms

%sortedRecordset A declared SortedRecordset object including its file/group context.
[%(SortedRecordset In filOrGrp name):] The optional class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a SortedRecordset Constructor.

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:

    %srecs = new %srecs = %(SortedRecordset in file sirLocal):new %srecs = %srecs:new

    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 SortedRecordset variable's declaration.

  • If you are creating an extension class of the SortedRecordset class, you can use New in the Construct statement in the extension class:

    class sordidSet extends sortedRecordset in sordid inherit ... constructor new construct %(sortedRecordset in sordid):new ... end constructor ... end class

    The Sort statement constructors cannot be used for this purpose.

Example

The New constructor has no parameters and simply instantiates an empty instance of its class:

%srs is object SortedRecordset in sordid ... %srs = new

See also