marco_tizzoni_automic

Configuration in VARA

Discussion created by marco_tizzoni_automic on Aug 8, 2017
Latest reply on Aug 8, 2017 by Wolfgang_Brueckler_1288
Hi,
I would like to have a configuration object like a key/value store. The key is the variable name and the value is the value of the variable. Then, I could read this store and dynamically define the variables.

The first idea was to user a VARA object and the SET_SCRIPT_VAR function. It works, however the SET_SCRIPT_VAR function requires the variable to be defined before. A snippet of can explain this better:

!:set &TEMP_FILE_DIR# = "" !:set &TEST# = "" ! :SET &HND#=PREP_PROCESS_VAR("VARA.CONFIG") :PROCESS &HND# :   SET &KEY# = GET_PROCESS_LINE(&HND#,1) :   SET &VALUE# = GET_PROCESS_LINE(&HND#,2) :   REGISTER_VARIABLE &KEY#, string :   SET_SCRIPT_VAR &KEY# = &VALUE# :   PRINT "&KEY# = &VALUE#" :   SET &temp# = GET_SCRIPT_VAR(&KEY#)             <<<<<<<------ FAILS HERE :ENDPROCESS :CLOSE_PROCESS &HND#
This code fails at eecution time with "Variable 'TEMP_FILE_DIR#' not found."

If I uncomment the first two lines then everything works, but then I could just have all definitions in a script. 
Any hint on how to implement  this?

Best,
Marco

Outcomes