VAR
Defines variables. Variables can be used to dynamically control script execution. You can store different types of values in variables. The syntax is:
Syntax
VAR[Variable name][Variable value]
Parameters
Variable name
The name of the variable. Use descriptive names.
Variable value
The value of the variable. The values can be of any type.
To reference a variable use the following syntax:
%VAR%
How to use a variable
1 In Main file, choose New. In the list of transformation instructions, choose VAR. Variable appears.
2 In Name, type the variable name, as shown in Figure 5‑56. In Value, type the variable value. In this example, the variable contains the name of a table.
Figure 5‑56 Creating a variable
3 In Variable, choose OK. Variable appears in Main file.
4 In Main file, choose New. In the list of transformation instructions, choose EXPESSION. Expression appears.
5 In Table, select a database from the drop-down list, and type the following expression in the table box, as shown in Figure 5‑57:
[%TABLE%]
Figure 5‑57 Using a variable
6 In Column, type the name of the new column.
7 In Expression, type the expression for calculating the value of the new column. Use the variable reference where needed.
[SalesData].[%TABLE%].[QUANTITYINSTOCK]*[SalesData].[%TABLE%].[MSRP]
8 Choose OK, and select Save, to save the expression.
9 Choose Run. The log, as shown in Figure 5‑58, displays that the TABLE variable is replaced by its value, CarInventory.
Figure 5‑58 Running a project