AutoMate variables play an important role in the creation of intelligent, nimble automated processes because they enable developers to add flexibility to a task. Rather than entering data directly into a task, a developer can use variables as a means to provide temporary storage for dynamic data in which to call upon during execution of the task. This makes it possible for the same task to process different sets of data each time it executes.
In AutoMate BPA Server, variables take on a much larger role because they have the ability to become “Shared Variables”. Shared variables are essentially variables that are accessible throughout an entire workflow. They are identical to normal variables in that their value can be interpreted, set or changed during task execution. But unlike normal variables that are created and shared within a single task, the value of a shared variable can be read by other workflow objects or its contents modified by other tasks that reside in the same workflow. Once a Shared Variable is created, its contents can be called upon by other workflow objects (i.e. tasks, evaluation objects, etc.) at runtime by enclosing the variable name with percentage (%) signs.
Shared variables are declared at the workflow level. This informs the workflow that the contents of the variable can be shared between all objects in the workflow. For example, a workflow’s path includes several tasks which are named Task1, Task2, Task3 and Task4. If a variable created in Task1 running on Agent A, is declared by the workflow as a shared variable, (by entering the variable name in the Shared Variables tab), that variable and its value can be accessed and/or modified by Task2, 3 or 4 running on any Agent as long as those tasks are executed within the same workflow.
In order for a variable to be declared as a shared variable, it must be added to the Shared Variables tab of the Workflow Designer. Follow the instructions below to accomplish this:
From the Workflow Designer, select the Shared Variables tab.
Right click anywhere inside the Shared Variables section. This will display a pop-up menu. Select the Add Variable option as shown below, circled in red.
A dialog titled Workflow Variable appears as shown below. Enter any specific data contained in the General and Advanced tabs.
Click Ok to save the settings and close the properties dialog.
Shared Variables are used as a storage mechanism to store and share data during the execution of a workflow. The Workflow Variable dialog described above is used to enter the name of the shared variable, its initial value (if required) and other parameters that dictate its behavior. The available parameters are described below.
Specifies the name of the variable that should be shared throughout the workflow.
Specifies the value that the variable should be set to initially. As with all parameters, this value may be literal or an expression (if surrounded by percent % signs).
An optional text description that describes the purpose of the shared variable.
Causes the variable to assume a specific type.
The available options are:
Auto - The variable will auto-detect whether it is populated with a number or text. The variable will adapt to the proper type when possible depending on the operation being performed.
Text - Variables will always be treated as text (by default) regardless of its contents. If an operation is attempted that is only valid for numbers, an error will be generated.
Number - Variable will always be treated as a number regardless of it's contents. If an operation is attempted that is only valid for numbers, an error will be thrown.
If enabled, the value of the shared variable that resides in the parent workflow is allowed to be passed to any embedded workflow (or sub-workflow). If disabled, the value of the shared variable is only available to the parent workflow.
If enabled, the value of a shared variable encompassed in the embedded workflow does not propagate back to the parent workflow upon the embedded workflow’s completion. If this value is disabled, the specified shared variable’s value will be available to the parent workflow.
To ensure that shared variables can be passed between the parent and embedded workflow and vice versa, make sure to ENABLE the Treat as Parameter option and DISABLE the Variable is Private option.
Only shared variables with the same name are passed between parent and embedded workflows and vice versa (when the settings permit).
Remember not to use percentage signs when specifying the name of a variable to populate, percentage signs are only needed to get data "out".