Switch to another workflow lane based on condition (classic if - then)

Hi there,

I simply can’t get my head around it: I have a classic if then condition.

Roll a dice
–> if number is even (2,4,6), execute upper part of the workflow
–> if number is odd (1,3,5) execute lower part of the workflow.

Wanted to do it with the rule engine but that has only one out port.

IF Switch seemed to be correct but doesn’t allow for checking any conditions.

What am I doing wrong?

:slight_smile:

Hello @kowisoft,

roll a dice; if 2,4,6 create “top” and if 1,3,5 create “bottom” flow variable to control IF Switch node.

Check this example where @mlauber71 used Java Snippet to create top/bottom flow variable. Rule Engine + Table Row to Variable works as well.

Br,
Ivan

3 Likes

Thank you for the response @ipazin

As I tend to shy away from “coding” :wink:

Hence I found another solution using the “Case Switch” node (for anyone who is as scared as I am from coding) :slight_smile:

I created a column which holds the term “activebranch” as content in a Table Creator node and then use that column in the rowID node as the new rowID which then is used in the Table Column to Variable node, see screenshot below:

2020-11-13 14_37_46-KNIME Analytics Platform

3 Likes

Hello @kowisoft,

glad you found a way.

Br,
Ivan

2 Likes

can you share a sample of your workflow with sample data? would like to understand it better

Hi Daniel,

sure, see here:

The workflow has three branches, depending if the dice rolled 1 or 2, 3 or 4, 5 or 6.

And I have learned to use the KNIME hub along the way :grin:

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.