Navigation: Templates > Template Language Reference > Complete Alpha Listing >====== #ALIAS/#TRYALIAS (access a symbol from another instance) ====== | |
#ALIAS( newsymbol , oldsymbol [, instance ] )
#TRYALIAS( newsymbol , oldsymbol [, instance ] )
#ALIAS / #TRYALIAS | Declares a synonym for a user-defined symbol. |
newsymbol | Specifies the new synonym for the oldsymbol. |
oldsymbol | The name of the symbol for which to declare a synonym. This must meet all the requirements of a user-defined symbol. This must not be a #PROMPT symbol or a variable in the same scope. |
instance | An expression containing the instance of the addition containing the oldsymbol. |
The #ALIAS statement declares a synonym for the user-defined oldsymbol declared in a #CODE, #CONTROL, or #EXTENSION template prompt for use in another.
The #TRYALIAS statement is similar to #ALIAS except that the symbol is only defined by the template referred to by oldsymbol. If oldsymbol is not defined, no template error is posted.
Example:
#EXTENSION(GlobalSecurity,'Global Password Check'),APPLICATION
#DECLARE(%PasswordFile)
#DECLARE(%PasswordFileKey)
#EXTENSION(LocalSecurity,'Local Procedure Password Check'),PROCEDURE
#ALIAS(%PswdFile,%PasswordFile,%ControlInstance)
#ALIAS(%PswdFileKey,%PasswordFileKey,%ControlInstance)
#GROUP (%QueryHasLocator, %WhichInstance),AUTO
#TRYALIAS (%CurLocatorType, %LocatorType, %WhichInstance)
#IF (VAREXISTS(%CurLocatorType))
#RETURN (%CurLocatorType)
#END
#RETURN ''
See Also: #CODE ,#CONTROL ,#EXTENSION