Skip to main content

Aliases (Property Keyword)

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

FeedbackOpens in a new tab