How to use the IF Switch properly

Hi All,

I have an IF Switch inside a Variable Loop to decide whether the workflow need to write an excel file or not based on predictor I’ve set in the Rule Engine Variable node. This is how I’ve designed the workflow.

I just want to know whether my approach on using the IF Switch on my case is correct.

Is it necessary for me to have 2 connectors out from IF Switch output port 0 to connect to Excel Writer & End IF nodes?
Do I need to connect Excel Writer with End IF node with Flow Variable connector?
Do I even need to use End IF node?
And If I don’t use the End IF node, which node should connect to Variable Loop End?

Regards.

Hi @ryudhanto,

I don’t dare to answer your question without trying it out, but maybe the “Flow Variable IF Switch” is in this case more appropriate and elegant than the regular “IF Switch”, as the connectors in your if switch don’t have any purpose.

Best
Aswin

Edit: the “Flow Variable IF Switch” is in the Vernalis KNIME Extension. The result could look like this:

1 Like

Hi @Aswin ,

Thanks for your elegant solution, but I don’t have this Vernalis extension installed yet on my system.
So I’m thinking to use Case Switch Variable in place of your Flow Variable IF Switch, something like this:


What’s your thought on this ?

Regards

2 Likes

Yes that is probably the best solution! But come to think of it, although your original solution looks a bit odd at first, I think it should work as well. The End IF might not even be necessary when you connect the flow variable outport of the IF Switch with the Loop End because inactive table branch is not passed on to the rest of the workflow (no need to recombine it with an active branch). Or you could even attach the Variable Loop End to the Loop Start directly and it would still work :smile:

1 Like

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