Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 7 Working With Variables : Process Variables

Process Variables
Process variables are data structures available to the activities in the process. Process variables are displayed in the Process Data panel of each activity’s Input tab. This allows you to use process data to supply input values for an activity. Each process variable name starts with a dollar sign ($).
There are four types of process variables:
Activity Output
Some activities produce output. Activities have access to any data that is output from previously executed activities in the process definition. An activity’s output is placed into a process variable with the same name as the activity (with a dollar sign placed in front of the name to indicate it is a process variable).
Activities can use output from previously executed activities by mapping data from the process variable to the activity’s input. See Input for more information about the Input tab and mapping process data to an activity’s input.
Predefined Process Variables
There are two process variables that are available to all activities that accept input: $_globalVariables and $_processContext. $_globalVariables contains the list of global variables defined on the Global Variables tab of the project. See Global Variables for more information about global variables. $_processContext contains general information about the process, such as the process ID, the project name, whether the process was restarted from a checkpoint, and so on.
Only global variables that have the Deployment option checked (on the advanced editor dialog) are visible in the $_globalVariables process variable. Also, only global variables with well-formed XML names (for example, names containing a % are not well-formed) appear in the $_globalVariables process variable. However, global variables of the type ’Password’ are not listed under the $_globalVariables process variable.
Error Process Variables
When an error occurs in a process, the data pertaining to the error is placed into process variables. The $_error process variable contains general error information. Activities can also have error process variables named $_error_<activityName>. In the event of an error, the activity’s error variable is populated with the appropriate error schema.
See Chapter 10, Error Handling for more information about handling errors and error process variables.
User-Defined Process Variables
You can define your own process variables and assign values to them in your process definition. Process variables are defined on the Process Variables tab of the Process Definition resource. You create a process variable in the same way you create data schemas for activities. See Editor for more information about creating data schemas.
Figure 23 illustrates creating a process variable. You add a process variable and give it a name in the left-most panel, then you create its schema in the middle panel.
Figure 23 Creating a process variable
To assign a value to a user-defined process variable, use the Assign activity. Assign allows you to specify which process variable you wish to modify. Only user-defined process variables can be modified. You can then specify a new value for the process variable in the Input tab of the Assign activity. Figure 24 illustrates assigning a value to a user-defined process variable.
Figure 24 Assigning a value to a user-defined process variable
When you use the Assign activity, the entire contents of the process variable is replaced by the specified new contents. That is, if you do not supply a value for an element in a process variable, that element no longer contains a value at run time. Therefore, use the Assign activity to reset the value of a process variable, and make sure to supply the correct values for all elements in the process variable.
See TIBCO ActiveMatrix BusinessWorks Palette Reference for more information about the Assign activity.
Memory Usage of Process Variables
All process variables in a running process instance are stored in memory and therefore consume system resources. Memory saving mode allows memory used by a process variable to be released when the value of the variable is no longer needed. When using memory saving mode, as each activity is executed, the list of process variables is evaluated to determine if subsequent activities in the process refer to the variable. If no activities refer to the variable, the memory used by the variable is released.
Memory saving mode can reduce the memory used by actively running process instances, as well as potentially improve the performance of checkpoints. By default, memory saving mode is disabled, but you can enable memory saving mode for specific process instances by setting the EnableMemorySavingMode.<processname> property to true. You can enable memory saving mode for all process instances by setting the EnableMemorySavingMode property to true.
See TIBCO ActiveMatrix BusinessWorks Administration for more information about setting properties.

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved