9 6 9 Implement an Activity Processor for an Iterator Activity

LANSA Composer

9.6.9 Implement an Activity Processor for an Iterator Activity

Iterator Activities are a special form of Activity that can be used to perform iterative processing in a Processing Sequence.  Refer to  Iterator Activities for more information.

If you define your own Iterator Activities.  you must implement the Activity Processor in a particular way such that it supports the iterative behavior.  The Activity Processor for an Iterator Activity must stay active but return control to the Processing Sequence controller for each iteration.  It does this by calling the ExecuteIteration method provided by the DXACTBAS1 ancestor class for the purpose.

Before calling the ExecuteIteration method it should set any output variables, especially if their values change from one iteration to the next (as would be typical for an Iterator Activity).  Refer to 9.6.7 Access the Variable Pool for information on setting output variables values.

Each time your Activity Processor executes the ExecuteIteration method, it returns control temporarily to the Processing Sequence controller, thereby enabling the Processing Sequence controller to execute all the Processing Sequence directives that might be nested beneath the Iterator Activity.

The ExecuteIteration method returns a Boolean value that indicates whether processing should continue.  If the return value is False, the Activity Processor must immediately end without attempting to perform further iterations.  This may occur, for example, where an exception occurred or a LEAVE Processing Sequence directive was encountered while executing the block of Processing Sequence directives nested beneath the Iterator Activity.

The example below shows how the ActivityRun method is implemented for the supplied FOR_EACH_INDEX Activity - a very simple (but nevertheless useful) example of an Iterator Activity.