Task Variables

Overview


Task variables are visible to all functions within a task. They provide a means of sharing common data between more than one function. Task variables are similar to function parameters in that they are composed of a name, type and accessibility descriptor. The types supported by task variables are (and must remain) identical to those supported by a task function. Task variables also support optional descriptions. However, unlike function parameters, a task variable cannot be marked as optional. Advantages of Task Variables are:

NOTE: Task variables are different from local variables which are created using the Create Variable action. More on Local Variables.

Scoping & Accessibility


Scoping and Accessibility provide two different capabilities to AutoMate and serve two different but complimentary roles necessary to realize the full benefits of task functions and task variables. They are primary building blocks that can be used to build a solid foundation for a rich object-oriented approach to tasks.

Scoping limits a task variable’s visibility within a task (i.e. using a variable from “the inside”). Without proper scoping, it would not be possible to provide some of the best advantages to function-oriented design, including information-protection, modularity, maintainability and recursion. helps take large, unruly tasks and enforce logical restrictions to their structure to provide greater readability and maintainability. They can help optimize and enhance task execution speed by reducing the amount of variables that are present in the system at a given time. Scoping also helps avoid unintentional and confusing data changes and variables accesses, leading to easier debugging, and cleaner and more reliable tasks.

Similarly, accessibility provides the fundamentals of information-protection, encapsulation and interfacing, all of which are essential for an object-oriented approach to a language. The ability to set task variables and functions as public or private gives a task developer greater control over how a task is used by another task. It makes tasks more portable, manageable and documentable by providing outside access only to those parts of the task that are meant to be used, while providing the user full flexibility of functions.

AutoMate supports two levels of accessibility:

Public - The variable or function is visible and accessible to external tasks.

Private - The variable or function is not visible or accessible to external tasks.

Task variables are scoped outside of task functions, and all task variables are accessible to all task functions in that task.

The accessibility of a task variable can be adjusted to suit the information-protection needs of the task as it relates to an external or sub-task. By default, a task variable is public, meaning it is accessible to an external task or external task function. This is accomplished in different ways, depending on how the external task is referenced, but the behavior of the task variable is identical regardless. See External Tasks for more information.

Sub-Tasks

Sub-tasks are task files that are executed within another task by using the Start Task action.  In this situation, the parent task’s (i.e. the task executing the Start Task step)  public functions, public extended functions, public task variables, and any local variables marked as public created up to point where the Start Task step is encountered, are accessible to the sub-task.  All other variables and functions are not accessible to the sub-task.  Conversely, because the Start Task action is a synchronous operation, the sub-task’s public functions and public task variables are not accessible from the parent task.  This is fully backward compatible with previous versions of AutoMate, since in the past there was only one “function” (what is now called “main”), no task variables, and all (local) variables and extended functions were considered public.

Creating & Managing Task Variables


Because task variables are scoped outside of task functions, and all task variables are accessible to all task functions in that task, they are created and  presented in a separate panel located on the Steps pane.

To create a new Task Variable:

  1. From the Task Builder's Steps pane, click the Make new Task Variable button located on the top-right section of the Task Functions/Variables panel (shown above). This expands the panel where specific parameters can be set.

  2. Click the Add button. This opens a separate window titled Task Variable (shown below).

  1. Enter the variable name, variable type, access type value and optional description and click OK when finished.

  2. Click the Make new Task Variable button to collapse the panel.

To edit an existing Task Variable:

  1. From the Task Builder's Steps pane, click the Toggle button located on the top-right section of the Task Functions/Variables panel.

  2. Select the variable you wish to edit and click the Edit button.

  3. Make the desired modifications then click Ok when finished. Reflected changed appear in the main panel.

To delete an existing Task Variable:

  1. From the Task Builder's Steps pane, click the Toggle button located on the top-right section of the Task Functions/Variables panel.

  2. Select the variable you wish to delete and click the Remove button.

Parameters


The following table describes the parameters available during task variable creation/modification.

Property

Type

Description

Variable Name

Text

The name of the task variable to create.

Variable Type

Text (options)

The type of task variable to create. The available options are:

  • Variable

  • Array

  • Dataset

Access Type

Text (options

The task variable's access type. The available options are:

  • Public - The variable is visible and accessible to external tasks.

  • Private - The variable is not visible or accessible to external tasks.

Value

Text

The value of the task variable.

Description

Text

An optional description of the task variable.

See Also

Variables

Task Functions

Datasets

Arrays

Expressions

See Also


About Datasets | Workflow Designer | Multi-machine Workflows | Shared Arrays | Shared Variables | Expression Builder | Constants