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.
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).
When searching a parameter value assigned to Folder, Legislation, Company, or Site levels (regardless of the level of definition), 3 methods are available :
AGETVALCHAR(LEVCOD,TYPVAL,PARAM)
is used to get an alpha value.AGETVALNUM(LEVCOD,TYPVAL,PARAM)
is used to get an integer or local menu value.AGETVALDATE(LEVCOD,TYPVAL,PARAM)
is used to get a date value.These 3 methods take the same parameters: LEVCOD
, TYPVAL
, and PARAM
:
LEVCOD
is the code of your search assignment level. It can have the following values:
[V]CST_ALEVFOLD
: Folder.[V]CST_ALEVCPY
: Company.[V]CST_ALEVFCY
: Site.[V]CST_ALEVLEG
: Legislation.TYPVAL
is the code of Folder/Legislation/Company/Site (depending on LEVCOD).
PARAM
is the parameter code.#### 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:AGETUSERVALCHAR(PARAM)
is used to get an alpha value.AGETUSERVALNUM(PARAM)
is used to get a numerical or local menu value.AGETUSERVALDATE(PARAM)
is used to get a date value.These 3 methods take the same parameter: PARAM
:
PARAM
is the parameter code.#### 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. 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:
AGETVALERROR()
returns an error code of the last call of method 'GET_PARAM_xxx', and 0 if no error happened.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
Code | Signification |
---|---|
0 | Successful. |
1 | error: LEVCOD invalid. |
2 | error: PARAM empty. |
3 | error: You are looking for a parameter value not defined in the current folder. |
4 | error: TYPVAL empty. |
5 | error: PARAM does not exist. |
6 | error: PARAM is not the right type for the method you called. |
7 | error: PARAM can only be assigned at User level. |
8 | error: TYPVAL invalid. |
9 | error: Incorrect Date format. |
10 | error: PARAM is not defined at User level. |