#Opalis: Multi-valued data and parallel flows, how to use and control it

Opalis has the ability to not only branch out in parallel flows by design, but also to automatically split up in different flows based on the output it receives from a certain activity.

For example: if a textfile has 3 lines and an activity reads the entire text-file, a parallel flow will be launched for each line it found. Each flow will then proceed to individually execute the activities after the “Read Line’”-activity.

In this post I want to show how you can prevent or control this feature.

 

First of all, I created a folder “C:\temp” where I put a text file named “folders.txt”.

image

This textfile contained the names of folders I wanted to create in “C:\temp”.

image

I then created a simple flow which would read each line in “folders.txt” and then create a folder for each line found with the line-text as name.

image

image

image

To have some kind of logging available, I created a file results.txt (also in “C:\temp”) which would be appended when:

  • A line was read from “folders.txt”
  • An entire flow was completed

image

image

And off I went! The flow ran perfectly!

image

My folders where created:

image

And my results-file had content:

image

But wait a minute, why do I have 3 flows completed instead of 1?

Well, as you see, the flow split up after it found my 3 lines and kept running that way.

But what if I only want a “Flow complete” entry for just the one batch I ran?

In many Opalis-activites, you can choose how you want to handle the output that is generated from it. This is done in the properties-windows, in the “Run Behavior”-tab and then we have the “Published Data Behavior”.

image

Here we can choose to “flatten” the data, which means we won’t publish the output as an array (which causes Opalis to create parallel flows), but to rather compress the data in for example, a CSV.

Ok, this is what I need! No multiple flows means no unnecessary completion entries in my log!

I enabled this setting:

image

And ran my flow again:

image

As you see, all activities got only activated once. What would this result in?

image

 

Argh! This isn’t what I wanted! I got one folder with all foldernames. This is worthless!

Okay, so flattening the data won’t work out in our scenario, but what will?

Well, there is a certain standard workflow-activity called “Junction”.

image

What is it for? Normally it is used to fuse a branched workflow (done by design) back together, while retaining some data of one of the branches.

But hey, isn’t a parallel flow not the same thing as a branched-out one? The answer is “Yes, but there’s a catch.”. Let me show you.

I put my “Junction”-activity where I wanted the multiple flows to come back together.

image

To come back to the catch: you can’t republish data from anything that was done during the parallel execution. If you do configure the junction to republish data from “Create Folder”, it will not fuse the flows back together.

image

image

So if you don’t need to use this data anymore, this can be a viable solution for unwanted parallel flows. If we configure the junction not to republish anything we get the following result:

image

In the results-file I have:

image

Eureka, this is what I wanted!

 

So what is important to remember?

  • Multi-valued output results in branching of the workflow by default in Opalis
  • Output can be flattened in a CSV-format, which will result in a single continued flow
  • The “Junction”-activity can be used to fuse parallel flows back together, although any previous data cannot be reused

 

You can find the full flow here (save as).

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s