How to get information relating to the current context

This ‘How-to’ describes how to get information relating to the current context, for example the current user’s Sage X3 user code.

In a Sage X3 session, some basic global context information is provided in an instance of the class 'WMACONTEXT'. This instance is called '[V]GACTX'. Each class instance includes a reference to this context class named ‘ACTX’.

When there is an event where ‘this’ is available (‘this’ refers to the current class) some information can be retrieved using ‘this.ACTX.’. As shown in the following examples:

 Local char USER_LOCAL
 Local char AFOLDER_LOCAL
 Local char LAN_LOCAL
 Local char LANISO_LOCAL
 Local char LOGIN_LOCAL

 # current connected User code
 USER_LOCAL = this.ACTX.USER

 # current folder name
 AFOLDER_LOCAL = this.ACTX.AFOLDER

 # three character language code
 LAN_LOCAL = this.ACTX.LAN

 # five character ISO language code
 LANISO_LOCAL = this.ACTX.LANISO

 # current login information
 LOGIN_LOCAL = this.ACTX.LOGIN

If ‘this’ is not available, because there is no current class instance open, the information can still be retrieved by using ‘GACTX’.

You should only use ‘GACTX’ when there is no current class with the referenced context class.

Examples similar to those above:

 Local char USER_LOCAL
 Local char AFOLDER_LOCAL
 Local char LAN_LOCAL
 Local char LANISO_LOCAL
 Local char LOGIN_LOCAL

 USER_LOCAL = GACTX.USER
 AFOLDER_LOCAL = GACTX.AFOLDER
 LAN_LOCAL = GACTX.LAN
 LANISO_LOCAL = GACTX.LANISO
 LOGIN_LOCAL = GACTX.LOGIN

Additional information is stored in the context class 'WMACONTEXT'.

For more information, see the Workbench reference Context dictionary or the Developer guide context documentation.