Context parameters

APARAM is a child instance of class ACONTEXT. It implements a local cache to store the already accessed parameter values in order to avoid querying the database every time.

1. Parameter definition

The parameter definition has not changed at all. In version V12 like in version 6, the definition is based on the parameter dictionary function (GESADP).

2. Methods to retrieve parameter value

When searching a parameter value assigned to Folder, Legislation, Company, or Site levels (regardless of the level of definition), 3 methods are available :

These 3 methods take the same parameters: LEVCOD, TYPVAL, and PARAM:

Example:

#### Parameter AECLIDBG is of type Local menu and is defined at User level.#### Here we want to assign the value to Legislation FRA:Local Integer PARAM_VALUEPARAM_VALUE = fmet this.ACTX.APARAM.AGETVALNUM([V]CST_ALEVLEG, "FRA", "AECLIDBG")## To assign the value to Company ADX:PARAM_VALUE = fmet this.ACTX.APARAM.AGETVALNUM([V]CST_ALEVCPY, "ADX", "AECLIDBG")
to find a parameter value assigned at the user level (the level of definition must be user), 3 methods are available:

These 3 methods take the same parameter: PARAM:

Example:

#### Parameter SSODOMAIN is of Alphanumeric and is defined at User level.#### To assign the value to the current User:#### The usual inheritance logic is applied when retrieving X3 parameter valuesLocal Char PARAM_VALUEPARAM_VALUE = fmet this.ACTX.APARAM.AGETUSERVALCHAR("SSODOMAIN")
For more information about how the parameter values are retrieved, see the appendix.

3. Method for error handling

The returned value of the above six methods will be empty in case of problem (for example if the given Company code does not exist). Sometimes developers may need more information about the execution status; the Context cache provides the following method to get the error code (or status code) of the last call of one of these methods:

Example:

Local Char VALUE_CHARLocal Integer VALUE_NUMLocal Integer ERROR_CODEVALUE_CHAR = fmet this.ACTX.APARAM.AGETUSERVALCHAR("SSODOMAIN")# If the value returned is empty, it might be an errorIf VALUE_CHAR = ""ERROR_CODE = fmet this.ACTX.APARAM.AGETVALERR()If ERROR_CODE = 0# value of "SSODOMAIN" is retrieved successfully, but is emptyElse# let's manage the errorEndifEndifVALUE_NUM = fmet this.ACTX.APARAM.AGETVALNUM([V]CST_ALEVLEG, "FRA", "AECLIDBG")ERROR_CODE = fmet this.ACTX.APARAM.AGETVALERR()If ERROR_CODE = 0# value of "AECLIDBG" is retrieved successfullyEndif

Error code descriptions

CodeSignification
0Successful.
1error: LEVCOD invalid.
2error: PARAM empty.
3error: You are looking for a parameter value not defined in the current folder.
4error: TYPVAL empty.
5error: PARAM does not exist.
6error: PARAM is not the right type for the method you called.
7error: PARAM can only be assigned at User level.
8error: TYPVAL invalid.
9error: Incorrect Date format.
10error: PARAM is not defined at User level.

4. Appendix: How X3 manages the parameters