Workflow Design - Looping

Caution
Test the script(s), processes and/or data file(s) thoroughly in a test environment, and customize them to meet the requirements of your organization before attempting to use it in a production capacity.  (See the legal notice here)

 

Note: The workflow sample mentioned in this article can be downloaded from the Opalis project on CodePlex:  https://opalis.codeplex.com

 

Overview

This is a collection of Workflows that demonstrates how to use looping for Workflow Activities and Child Workflows.

Example Workflows

1. Sample Loops

image

This example demonstrates two types of loops:

  • a loop where the number of iterations defines when to exit the loop,
  • a loop where the total time spent in the loop determines when to exit the loop

This Workflow iterates five times over the Send Platform Event Activity ‘Loop Counting (5 Loops) ’. The Send Platform Event Activity is configured to display a summary message:

image

The looping properties (right mouse click, Looping…) are configured for a five second delay between each loop:

image

The loop will exit when five loops have been performed:

image

Next, the Workflow iterates over the Send Platform Event Activity ‘Loop Timing (25 seconds) ’ for twenty-five seconds. The Send Platform Event Activity is configured to display a summary message:

image

The looping properties (right mouse click, Looping…) are configured for a five second delay between each loop:

image

The loop will exit when more than twenty-five seconds have passed since the loop started:

image

Running the example Workflow

Launch the Workflow by using Start, or by running it using the Workflow Testing Console. Check the Opalis Designer Events tab or the Testing Console log to see the resulting output:

image

2.1 Loop a Child Workflow

image

This example demonstrates looping a child Workflow. The Trigger Policy Activity ‘Trigger Workflow: 2. Child Workflow’ is used to start the Workflow named ‘2. Child Workflow’ . By looping the Trigger Policy Activity, the child Workflow will be triggered for every loop cycle:

image

The looping properties (right mouse click, Looping…) are configured for a five second delay between each loop:

image

The loop will exit when three loops have been performed:

image

The Send Platform Activity displays a message to indicate that the loop and therefore the parent Workflow has completed:

image

2.2 Child Workflow

image

This Workflow will be triggered by the parent Workflow named ‘2.1 Loop a Child Workflow’ . The Send Platform Event Activity displays a summary message:

image

Running the example Workflow

Launch the Workflow ‘2.1 Loop a Child Workflow’ by using Start, or by running it using the Operator Console. Check the Opalis Designer Events tab or the Operator Console Event screen to see the resulting output:

image

More Information

Search the Opalis Online Help for 'Looping Properties' to get more information on Looping.

 

Share this post :