A variable is an object that stores a single value, which can be a string, a number
or a date.
Topics
Create a Variable You can specify the value of the variables when you create the variable or set the value using a query expression.
Use Variables in a Data Flow You can use variables in a data flow by using them as a filter definition. You can refer to variables in a data flow using the format #<variable_name>. During execution the variable is substituted by the value.
Use Variables in a Workflow The left panel of the Workflow Details page lists the variables that you can use as steps within a workflow.
You can specify the value of the variables when you create the variable or
set the value using a query expression.
The Variables page lists all the existing variables. Click the Actions icon () of a variable to edit, refresh, or delete it. All the available variables are also listed in the left panel of the Workflow Details page. You can use variables as steps in data flows and workflows.
To create a variable:
On the Home page, click the required Project title. You are navigated to the Project Details page.
In the left pane, click Variables. The Create Variable page appears.
Enter a name for the variable.
From the Data Type drop down, select one of the following:
Short text - The value can be alphanumeric, can contain special characters, and cannot exceed 255 characters.
Long text - The value can be alphanumeric, can contain special characters, and cannot exceed 64000 characters.
Numeric - The value can be a numeric value and can be preceded by a minus (-) sign. The value cannot exceed 10 digits. Possible value range is -999999999 to 9999999999.
Date - The value is a date format.
In the Default Value field enter the value you want to assign to the variable. The allowed value depends on the Data Type you select.
For variables that you modify, you can click the Actions menu next to the variable to open the Refresh Variable page to update the value. From the Keep History drop down select how you want the variable value to be displayed in the Refresh Variable page:
All Values - You can see the history of all the values held by this variable.
Latest Value - You can see only the latest value specified for the variable.
No History - Data Transforms does not keep the history of the values held by this variable.
Secure Value - This is useful when the variable contains passwords or other sensitive data. The value is not displayed in the Refresh Variable page.
Enter a description for the variable.
If you want the variable value to be set by a query, click the Refresh tab. Select the connection type and schema where you want to execute the command. Enter the query and click Validate to check the syntax of your expression.
Click Save.
The newly created variable is listed in the Variables page as well as in the Variables node in the left panel of the Workflow Details page.
You can use variables in a data flow by using them as a filter definition.
You can refer to variables in a data flow using the format
#<variable_name>. During execution the variable is
substituted by the value.
When you execute the data flow, the Variable values page appears that
displays the list of variables that you have added to the data flow. You can choose to
use the current value, the default value, or set a custom value for each variable. Note
that the custom value is applied only to the current run of the data flow. The custom
value does not persist for any subsequent sessions.
Here is an example of
the use of a variable in a data flow:
In this example, the data flow uses the variable DEVICE_TYPE as
a step with the filter condition set as follows:
MOVIESALES_CA.DEVICE = '#DEVICE_TYPE'
The
variable is quoted because the substituted value needs to be quoted. Since the
variable value is substituted during execution, you can use it for many use cases
such as in the transformation expression in the mapping.
The left panel of the Workflow Details page lists the variables that you can use as steps within a workflow.
You can drag and drop the variables you want to use in the workflow on the design
canvas. The Properties Panel available on the right side of the design canvas
displays various details about the step such as the following.
Name, Type, and the Step sequence number.
These are non-editable values.
Click the link under Linked Object to view and update
the details about the variable.
Operation: Select any one from the following:
Set Variable - There are two functions for this
step:
Update sets the current value of a
variable.
Increment increases or
decreases a numeric value by the specified amount.
Refresh Variable - This variable step refreshes
the variable by running the query specified in the variable
definition.
Evaluate Variable: This variable step type
compares the value of the variable with a given value according to
an operator. If the condition is met, then the evaluation step is
true, otherwise it is false.
Number of attempts on Failure
Time between attempts in seconds(s)
Log steps in journal - You can select from Always, Never,
or Error.
When you execute the workflow, the Variable values page appears
that displays the list of variables that you have added to the workflow. You can
choose to use the current value, the default value, or set a custom value for each
variable. Note that the custom value is applied only to the current run of the
workflow. The custom value does not persist for any subsequent sessions.
Here is an example of the use of a variable in a workflow:
In this example, a variable called DEVICE _TYPE with the value "iphone" is used as a step in the workflow. The workflow performs the following actions:
Execute the "REFRESH_DEVICE data flow.
If the "REFRESH_DEVICE" data flow execution is successful, execute the "Load_movies_for_device" data flow.
If the "Load_movies_for_device" data flow execution is successful, execute the "IF_IPHONE" variable evaluation step.
If the variable value is equal to ‘iphone’, execute path for “true”.
If the variable value is not equal to ‘iphone’, execute path for “false”.