Michael_Lowry

GENERATE_SCRIPT_VARS — generate script variables on-the-fly

Discussion created by Michael_Lowry on Dec 11, 2017
Latest reply on Jun 19, 2018 by Michael_Lowry

AE v12.1 introduces a useful new scripting function called GENERATE_SCRIPT_VARS. This function is not mentioned in the v12.1 release highlights or release notes, so I thought I would mention it here.

 

The GENERATE_SCRIPT_VARS function allows one to generate script variables on-the-fly based on information stored in a VARA object. (To use this scripting statement, you must set the GENERATE_UNDEFINED_SCRIPT_VARS setting in UC_SYSTEM_SETTINGS to Y.)

 

Imagine you have the static VARA “UC0.TEST1.VARA_STATIC” object defined with the following keys & values:

KeyValue 1Value 2Value 3Value 4Value 5
vara1key1vara1key1value1vara1key1value3vara1key1value3vara1key1value4vara1key1value5
vara1key2vara1key2value1vara1key2value3vara1key2value3vara1key2value4vara1key2value5


Using the GENERATE_SCRIPT_VARS function, you can generate script variables based on the values stored in the VARA object. E.g.,:

:SET &RC1# = GENERATE_SCRIPT_VARS(UC0.TEST1.VARA_STATIC,APPEND_POUND_SIGN,ABORT)
:PRINT GENERATE_SCRIPT_VARS RC: &RC1#
:PRINT &VARA1KEY1#
:PRINT &VARA1KEY2#

This will produce the following output:

2017-12-11 13:59:31 - U00020408 GENERATE_SCRIPT_VARS RC: 0000000000000000
2017-12-11 13:59:31 - U00020408 vara1key1value1
2017-12-11 13:59:31 - U00020408 vara1key2value1

The the GENERATE_SCRIPT_VARS function also accepts as its first argument the name of a variable containing a data sequence created using the PREP_PROCESS_VAR function. The following script will produce the same result as the one in the first example above.

:SET &VARA_HND# = PREP_PROCESS_VAR(UC0.TEST1.VARA_STATIC)
:SET &RC2# = GENERATE_SCRIPT_VARS(&VARA_HND#,APPEND_POUND_SIGN,ABORT)
:PRINT GENERATE_SCRIPT_VARS RC: &RC2#
:PRINT &VARA2KEY1#
:PRINT &VARA2KEY2#

I was unable to find a way to use values from any value column other than #1.

Outcomes