:SET_SCRIPT_VAR

Script statement: Sets the values of script variables through indirect access.

Syntax

:SET_SCRIPT_VAR Script variable = Value

Syntax

Description/Format

Script variable

A placeholder for the name of the script variable that should obtain a value.

You must always use an ampersand symbol (&) that precedes the script variable's name, and it is recommended that you use a hash (#) symbol to signal the end of the variable's name.

The length of a script variable's name is limited to 32 characters. All characters of the alphabet, the numbers 0-9, and the following special characters can be used:"$", "_", "@", "ยง" and "#". German Umlauts are not allowed. The first character after the leading "&", which is not part of the 32-character limit, must neither be a number nor a "$" symbol.

Format: script literal or script variable

Value

The value that is assigned to the script variable.

Format: script, script variable or script function

Comments

This script statement sets the values of script variables. It is not necessary to explicitly specify the names of the script variables because they are indirectly be accessed through placeholders. The placeholder is a string that must include as many initial letters of the script variable to which a value should be assigned as is necessary to clearly identify it. With this string, you can easily set the values of many script variables, for example in a process loop.

Important!

Example 1

This example sets the script value &var_name# to the value of &var_value#.

:SET &VAR_1# = ""

:SET &var_name# = "VAR_1#"

:SET &var_value# = "ABC"

:SET_SCRIPT_VAR &var_name# = &var_value#

:SET &temp# = GET_SCRIPT_VAR(&var_name#)

:PRINT "Variable name stored in &&var_name# : &var_name#"

:PRINT "Value from :SET_SCRIPT_VAR/GET_SCRIPT_VAR : &temp#"

:PRINT "Value retrieved directly from variable : &VAR_1#"

Report extract:

2017-01-10 10:10:38 - U00020408 Variable name stored in &var_name# : VAR_1#

2017-01-10 10:10:38 - U00020408 Value from :SET_SCRIPT_VAR/GET_SCRIPT_VAR : ABC

2017-01-10 10:10:38 - U00020408 Value retrieved directly from variable : ABC

Example 2

This example uses a Variable object and a job. In the Variable object, the key includes the names of the script variables End#, Start#, and Ultimo# and their respective values.

In a processing loop, the job script reads the script variable names from the Variable object's Key column. Then it reads the script variable values from the second column. Afterwards, 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#  

You can use PRINT to have the Variable object's values output in the activation report (Key = Value 1).

Report extract:

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:

Script element Description

RESOLVE_VAR

Resolves any kind of variable (prompt values, system variables, script variables, variable objects) in text.

GET_SCRIPT_VAR

Returns the values of script variables by indirect access.

:PSET

Assigns a value to an object variable.

:RSET

Assigns a value to a script variable and saves it to the activation report.

:SET This assigns a value to a script variable. The statement can be written in short or long form.

Script Elements - Script Structure and Processing

About Scripts
Script Elements - Alphabetical List

Script Elements - Ordered by Function