Difference between revisions of "Variables"

From PresenceWiki
Jump to: navigation, search
 
Line 3: Line 3:
 
Each Variable has a ''name'' and a ''value''. Variable names always take the following form:
 
Each Variable has a ''name'' and a ''value''. Variable names always take the following form:
  
${variableName}
+
'''${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]].
 
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]].
Line 9: Line 9:
 
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:
 
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:
  
<ul>
+
====Local Visibility====
<li>'''Local:''' Local variables can only be read within the current Task. Furthermore, they can only be read <i>after</i> they have been set.</li>
+
 
<li>'''Task:''' Task variables, like local variables, can only be read within the current Task. However the difference between them and local variables is that Task variables can be read anywhere in the Task once they have been set.</li>
+
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.
<li>'''Global''': Global Variables can be accessed by any Task once they have been set. Global Variables can either be set in a Task using the [[Set Variable]] Node, or through the Administration Client menu (Task > Manage Global Variables).</li>
+
 
</ul>
+
====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.

Revision as of 09:16, 23 June 2010

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.