InterSystems IRIS Data Platform 2019.2  /  Class Definition Reference  /  Property Keywords

Class Definition Reference
Previous section           Next section
InterSystems: The power behind what matters   

Specifies an initial value for this property.
To specify an initial value for this property, use the following syntax:
Property name As classname [ InitialExpression = initialexpression ];
Where initialexpression is a constant or an ObjectScript expression enclosed in curly braces.
This keyword specifies an initial value for the property. This value is assigned by the %New() method of the class when a new instance is created. (If a property is transient, then its initial value is determined either by code invoked by %New() when the instance is created or by code invoked by %OpenId() when the instance is loaded from disk into memory.)
The value of the initial expression must be suitable for the given property type.
The expression can be arbitrarily complex, with the following limitations:
Subclasses inherit the value of the InitialExpression keyword and can override it.
The default value for the InitialExpression keyword is null.
The following shows several examples that use ObjectScript expressions:
Property DateTime As %Date [ InitialExpression = {$zdateh("1966-10-28",3)} ];

Property MyString As %String [ InitialExpression = {$char(0)} ];

/// this one is initialized with the value of a parameter
Property MyProp As %String [ InitialExpression = {..#MYPARM} ];

/// this one is initialized by a class method
Property MyProp2 As %Numeric [ InitialExpression = {..Initialize()} ];
See Also

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-09-20 05:47:55