9 6 7 Access the Variable Pool

LANSA Composer

9.6.7 Access the Variable Pool

When a Processing Sequence runs, it manages a variable pool which is a pool of loosely typed named variables and variable lists that are shared across the Processing Sequence, Activities and Transformation Maps.

Your Activity Processor can access the variable pool using methods provided by the ancestor class.

Call the following methods to:

  • Clear lists and variables, you can call these methods:
  • ClearList
  • ClearVariable
  • Retrieve the values of variables from the variable pool:
  • GetTradingPartner
  • GetVariable
  • GetVariableRequired
  • Change the values of variables in the variable pool:
  • PutVariable

Variable Lists

References to variables in the variable pool can be indexed. In this way, variable lists may be created. In a Processing Sequence a list can be processed iteratively using a LOOP Processing Directive.

Any variable can be used as a list simply by indexing references to it. In your Activity Processor, you can index references to variables using the iIndex parameter of the ClearVariable, GetVariable or PutVariable methods.

Indexed references to variables should use contiguous indices starting from 1. The LOOP Processing Directive will only process instances that meet this condition.

When your Activity Processor creates a list with the PutVariable method, it will typically do so inside a loop in which you increment the value of the iIndex parameter for each call.

When your Activity Processor needs to read an existing list, it does so with the GetVariable method inside a loop. The GetVariable method defines an output parameter, oResult, which is set to True if the variable with the specified index is found, or False if not. Thus the list processing loop can terminate when the oResult parameter is False.