Working with Multi-Value Data

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

A collection of Workflows that demonstrate how the Opalis Workflow Engine handles sets of data.

Getting Started

Launch the Workflow named ‘0.Setup’ by using Start or by running it using the Testing Console.

The Workflow will create a sample input.txt file on your C drive. The sample input.txt file will be used by the other Workflows and has following content:

1
2
3
4

Example Workflows

1. Multi-Value Data

image

This Workflow uses the Read Lines Activity to read all lines from the sample text file ‘input.txt’:

image

The Send Platform Event Activity displays the line text from the Read Lines Activity by subscribing to its Published Data:

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

There will be four Events, one for each line that is read from the sample text file ‘input.txt’.

2. Flatten Multi-Value Data

image

This Workflow is the same as the Workflow named ‘1. Multi-Value Data’ , except that the ‘Run Behavior’ properties of the Read Lines Activity is configured to flatten the multi-value Published Data and return a delimited string instead that uses ‘;’ as the separation character:

image

The Send Platform Event Activity displays the line text from the Read Lines Activity by subscribing to its Published Data:

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

image

There will be one Event that contains the delimited string that was created by ‘flattening’ the multi-value Published Data from the Read Lines Activity.

2. Filter Multi-Value Data

image

This Workflow is the same as the Workflow named ‘1. Multi-Value Data’ , except that there is an extra Compare Values Activity that filters the Published Data from the Read Lines Activity:

image

For comparison of numeric values, the proper Type needs to be specified in the General Properties of the Compare Values Activity:

image

The result from the Compare Values Activity is evaluated so that the Send Platform Event Activity will only trigger for values greater than 2. This is accomplished by using a Link Condition that is configured in the Link properties:

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

There will be two Events, one for each line that is read from the sample text file ‘input.txt’ and has a value greater than 2.

 

 

 

Share this post :