:SET_SCRIPT_VAR

Use the :SET_SCRIPT_VAR script statement to set the values of script variables indirectly, without having to explicitly specify the names of the script variables. The statement uses a placeholder to set the values. :SET_SCRIPT_VAR lets you set the values of multiple variables with a single script line, and is useful in processing loops. The placeholder that you define is a string that contains the name of a variable whose values you want to set.

Syntax

:SET_SCRIPT_VAR Script variable = Value

Parameters

Note: The script statement does not create script variables. Use the :SET script statement to create the script variables first, and assign initial values.

Important!

Example

The following example uses a VARA object and a Job. Assume that there are three variables stored in the VARA object, with a value defined for each variable. The variable names (End#, Start#, and Ultimo#) are defined in the first column (Key) on the Variables page in the object definition, and the values are stored in the second column (Value 1).

The Job object includes a script that defines a processing loop. The script reads the script variable names from the first column in the VARA object, and the variable values from the second column. The script assigns the retrieved values to the variables &END#, &START# and &ULTIMO#.

:SET &END# = ""
:
SET &START# = ""
:
SET &ULTIMO# = ""

:
SET &HANDLE# = PREP_PROCESS_VAR(VARA.NEW.7)

:
PROCESS &HANDLE#
:
SET &VARIABLE# = GET_PROCESS_LINE(&HANDLE#,1)
:
SET &VALUE#   = GET_PROCESS_LINE(&HANDLE#,2)
:
SET_SCRIPT_VAR &VARIABLE#=&VALUE#
:
PRINT "&VARIABLE# = &VALUE#"
:
ENDPROCESS

:
CLOSE_PROCESS &HANDLE#  

The :PRINT statement writes a line for each retrieved script variable name (Key) and corresponding value (Value 1) in the activation report:

2017-02-28 13:46:59 - U0020408 End# = 20170227
2017-02-28 13:46:59 - U0020408 Start# = 20170224
2017-02-28 13:46:59 - U0020408 Ultimo# = 20170228

See also:

seealso

:DEFINE

GET_SCRIPT_VAR

seealso1

RESOLVE_VAR

Variables and VARA Objects

Script Elements for Variables and VARA Objects