Case Switch


hello everyone. In the above image, I have a component with 4 branches…I want to switch between (upper two branches) and (lower two branches ). The problem is in upper two branches should work together when MODEL_TYPE as variable but the input from component is different so I don’t how to make them work together.
kindly help.

Hello @Anoshpananda,

and welcome to KNIME Community!

Not sure I understand your requirement completely. So you have 4 branches in Component (guess you are not counting one towards Table Row to Variable node) and you would like to control active branches based on MODEL_TYPE variable? So for example when it has value “A” then upper two branches are active and if it has value “B” then bottom two branches should be active?

Additionally what KNIME version are you using?

Br,
Ivan

Thank you :slight_smile: and yes you understood correctly except I want to check if MODEL_TYPE variable is available (not the value within it) than above two branches activate otherwise lower two branches.

Best Regards
Anoshpa

I am using knime version 4.3.2.

Hello @Anoshpananda,

I see. Then you should make use of Java Snippet node as it features function to check if flow variable exists (flowVariableExists). I have created a workflow example so you can check it out. Take a look and if any questions feel free to ask.
2021_06_11_IF_Switch_Variable_Existance.knwf (62.3 KB)

Make sure that you configure Component Input to allow MODEL_TYPE variable to be visible from outside otherwise you’ll always end up with lower branches running :wink:

Br,
Ivan

1 Like