Like variables, arrays are used to represent data in a task that may be different each time a task runs. But unlike standard variables, arrays can contain multiple rows and optionally multiple columns. In AutoMate, arrays have the ability to become ”Shared Arrays” which are arrays that are accessible throughout an entire workflow. Unlike normal arrays that are created and shared within a single task, the value of a shared array can be read by other objects or modified by other tasks that reside in the same workflow.
Shared arrays are declared at the workflow level. This informs the workflow that the contents of the array can be shared between all objects in the workflow. For example, if an array created and altered in Task A running on Agent A, is declared by the workflow as a shared array, the values of that array can be retrieved and modified in Task B, C or D running on other Agents within the same workflow.
In order for an array to be declared as a shared array, it must be added to the Shared Arrays tab of the Workflow Designer. Follow the instructions below to accomplish this:
From the Workflow Designer, select the Shared Arrays tab.
Right click anywhere inside the Shared Arrays section. This will display a pop-up menu which provides the option to Add, Edit, Rename or Delete a shared array as shown below. Select the Add Array option as shown below, circled in red.
A dialog titled Workflow Variable appears as shown below. On the General tab, enter the following information:
Name: Specifies the name of the variable that should be shared throughout the workflow.
Initial value: 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).
Description: An optional text description that describes the purpose of the shared variable.
On the Advanced tab, enter the following information:
Variable Type: Causes the variable to assume a specific type. The available options are:
Auto: Variable will auto-detect whether it contains a number or text. Variable will adapt to the proper type when possible depending on the operation being performed.
Text: Variable will always be treated as text regardless of it's contents. If an operation is attempted that is only valid for numbers, an error will be thrown.
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.
Treat as parameter: Specifies that the variable will only be created if it does not already exist. This is particularly useful when a task may have parameters passed to it at runtime (that is, variables of the same name will be created automatically) but a default value should be assumed when debugging and parameters are not present.
Variable is private: Specifies that the variable is only available to the current task and not to sub tasks started with the Start Task action. If this value is left unchecked (default) the specified variable will be available to sub tasks.
After entering the proper information, click OK to save changes and exit the properties dialog.