Variables

From PresenceWiki
Revision as of 09:16, 24 June 2010 by Admin (Talk | contribs)

Jump to: navigation, search

Variables are bits of information or data that are stored in Presence's memory with a special name so that they can be reused throughout a Task.

Each Variable has a name and a value. Variable names always take the following form:

${variableName}

To set a value for a Variable, drag a Set Variable node into your Task. In the value field you can specify some text, a number, or you can reference another variable. You can also include the value of a field in the Data Table, or a Function Call.

Variables also have the concept of Scope. This refers to the visibility of the Variable (i.e. where it can be seen). The following Scopes are available:

Local Visibility

The variable and its value is stored in the current execution context which is passed from node to node. It is therefore only visible to nodes following this one. If the execution path branches before the value is altered, other branches will not be able to see the changes.

Task Visibility

The variable and its value is stored at the Task level. Changes to the value will be seen throughout the Task. If the execution path branches then changes along one branch will also be visible to other branches.

Global Visibility

The variable and its value are stored in the Presence database, making them visible to all Tasks on all servers. A variable can be changed by one Task and its value will be visible to another Task that references it. Note that due to transaction considerations, global variable changes are not committed until a Task successfully completes.

As Global Variables are often used to store password information or other sensitive data, an additional option is provided to password protect the value. When using a protected value a Variable Unlocker node must be used prior to referencing the variable.