Evaluation of InstallAnywhere Variables

InstallAnywhere 2018

InstallAnywhere variables can be set by reference or by value (evaluated at assignment). The default behavior for InstallAnywhere variables is to be set by reference—evaluated at execution time. However, variables defined by the Advanced Designer actions, Set InstallAnywhere Variable - Multiple Variables and Set InstallAnywhere Variable - Single Variable, can be expressly set to be evaluated at assignment. Hence, these variables keep the value they have when they are set.

Using the Evaluate at Assignment option allows you to define variables that are self-referencing. For example, a construction like $USER_DIR$=$USER_DIR$+"MY_SUB_DIRECTORY" can be used to redefine the value for $USER_DIR$. The same expression, without the Evaluate at Assignment setting, creates an infinite loop as it attempts to resolve $USER_DIR$.

Evaluate at Assignment Checked

The following is an example of evaluating an InstallAnywhere variable at assignment:

A=$USER_DIR$

B=A             //Set using Evaluate at Assignment (set by value).

 

A=A+"/mydir/"   //Set using Evaluate at Assignment.

print B

In the code above, B resolves to $USER_DIR$.

Evaluate at Assignment Unchecked

The following is an example of evaluating an InstallAnywhere variable by reference:

A=$USER_DIR$

B=A             //Set without using Evaluate at Assignment (set by reference).

 

A=A+"/mydir/"   //Set using Evaluate at Assignment.

print B

In the code above, B resolves to $USER_DIR$/mydir/.

Results of Evaluate at Assignment

The following table compares the two methods of evaluating variables:

Results of Evaluate at Assignment

Expression

Evaluate at Assignment

Result

$MY_VAR$=$MY_VAR$+".txt"

Checked

Appends .txt to the value of $MY_VAR$.

$MY_VAR$=$MY_VAR$+".txt"

Unchecked

Code error. Infinite loop.

See Also