Task Variables

Overview

Task variables provide a means of sharing common data within a single function or between more than one function. The parameters of a task variable are similar to that of a task function which comprise a Name, Type and Accessibility descriptor. In addition, a task variable also includes a Description parameter as a way to distinguish each variable. Unlike a task function, however, a task variable cannot be marked as Optional. Some advantages of task variables are as follows:

Task variables, functions and events are created and managed through a drop-down UI display that is accessible from the Steps panel of Task Builder (as shown below).

NOTE: Task Variables are different from Local Variables which are created using the Create variable activity. In addition, Task Variables are additional features aimed for advanced users. You can build tasks without the use of Task Variables and may choose to use them at your own pace.

Scope & Accessibility

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

Scope

Scope 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. Scoping 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.

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

Accessibility

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:

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.

Sub-Tasks

Sub-tasks are task files that are executed within another task by using the Start sub-task activity. In this situation, the parent task’s (i.e. the task executing the Start sub-task step) basic functions, extended functions, public task functions, public task variables, and any local variables (unmarked as private), created up to point where the Start sub-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 activity 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 & Defining Task Variables

 

Editing & Deleting Task Variables