branching flows based on IF condition

I have a workflow where the output of a node will vary based on its preceding R script node. based on certain conditions the output might either be an empty table like so:
Or a table like so:

I want to be able to branch the workflow like so:

I read up on If/Case switches, but it requires me initializing a variable. How to I initialize a variable based on the table output?

Sounds like a job for the Table Row to Variable node to extract the first row to a variable, followed by a Rule Engine Variable to convert the variable into a form that the IF Switch can understand:

2022-05-19 14_48_43-KNIME Analytics Platform

The rule might look something like this:

$${Dtool_id}$$ = 0 => "bottom"
TRUE => "top"

Then you need to adjust the IF Switch to use your created flow variable, of course.


Hello thentangler, I think you can use a " table row to variable " node and a “variable rule engine” branching out from R to table node to initiate the flow variable.


Thank you for that crash course on how to use flow variables with IF switches!

I thought it would be

$${Dtool_id}$$ = 0 => "bottom"
FALSE => "top"

Since the condition checking for tool_id =0 would be false and that would then goto the top port. Why do we set it as TRUE?

TRUE is a special case of “all other rows that don’t match one of the given rules”.

Thats good to know!
Thank You!

1 Like

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