Choose Data Source with Flow Variable

I have a workflow that performs some calculations on a dataset. Sometimes I want the data to be sourced from an Excel file, and other times I want the data sourced from the workflow itself from the data output port of another node. I’ve been playing around with the IF and SWITCH nodes, but I can’t seem to figure it out. I have a flow variable that indicates which scenario to use, but I’m not sure how to get the right data diverted in. Possible?

Hi @mikeyc1204 and welcome to the forum.

What you want to do is definitely possible. Have you checked the KNIME Hub? Maybe this workflow will help you understand the IF Switch a bit better.

Thanks Scott, I actually looked at that Hub example before posting. It seems with the IF Switch, I can choose a path to send a data set, and with the End IF I can consolidate 2 two data inputs, but I don’t see a place where I can select which port to funnel out, like I can with the IF Switch. In the solution I’m trying to build, I have steps 1 through 10 which feed into 11, but sometimes I just want an excel file to replace those first 10 steps, and feed directly to 11. So there’s no common data to feed the start of the switch, and no matter the source, I want to perform the same actions, so I don’t need a branch after the data is fed in. Hopefully I’m explaining that clearly.

Understood. Let me try to build you an example right quick then.

See if this helps you:

2022-06-30 11_52_36-KNIME Analytics Platform

DataSourceSwitchExample.knwf (39.4 KB)

2 Likes

Thank you very much! Exactly what I needed. I didn’t realize shutting off the variable input port would render the output port closed for the switch. I assumed a scenario where both branches were active and the data would combine at the end where I didn’t want it to.

Learning more every day. Thank you again!

1 Like

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