InterSystems IRIS Data Platform 2019.2  /  Class Definition Reference

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

Specifies additional names for this property for use via object access.
To specify additional names for the property, use the following syntax:
Property name As classname [ Aliases=othernames ]; 
Where othernames is a comma-separated list of valid property names, enclosed in curly braces.
If you specify the Aliases keyword, the compiler creates the given alias or aliases, which point to the same underlying data that the original property points to. For example, suppose we redefine the Name property of Sample.Person as follows:
Property Name As %String(POPSPEC = "Name()") [ Aliases = {Alternate}, Required ];
Then your code can then work with either the Name property or the equivalent Alternate property, as shown in the following Terminal session:
SAMPLES>set p=##class(Sample.Person).%OpenId(1)
SAMPLES>w p.Name
Fripp,Charles Z.
SAMPLES>w p.Alternate
Fripp,Charles Z.
SAMPLES>set p.Alternate="Anderson,Neville J."
SAMPLES>w p.Name
Anderson,Neville J.
Any property methods associated with the original property are also defined for each alias property, so in this example AlternateIsValid() is callable and returns the same result as NameIsValid() method does. Also if you override a property method (for example, writing a custom NameGet() method), then that override automatically applies to the alias property or properties.
This keyword has no effect on the SQL projection of the property.
By default, this keyword is null and a property has no aliases.
Property PropA As %String [ Aliases={OtherName,OtherName2} ]; 
See Also

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-08-16 05:50:13