Triggering one of the two components based on user choice

Hi All,

I have a workflow on server. I want to ensure that the user gets to choose whether they want to download the file on their local system or rather have it via email.

I have created two components for it but i want user to select only one of them. How can i achieve it ?

Hi @r_jain you can use the IF Switch for this. The IF Switch will allow you to have 2 routes, one for download, and one for sending via email. You can then re-route based on what the user selected.

1 Like

Hi,

Is there any example to go along with it?

I tried connecting my 2 component to if switch and connected the value widget to control what the user chooses, but i am having trouble with identifying on what port numbers/names are there in this for me to control it.

I would like

A single selection for Download file and one for E-mail file

Thanks

Hi @r_jain,

Here’s a basic example of a workflow using an IF Switch: If Switch / End If – KNIME Hub

In your case, if I was going to use this workflow on the server and possibly the KNIME Webportal I might turn it into a two step process like this:

Screenshot (161)

In this case I’m using a Case Switch node, but it’s the same general idea as an IF Switch node.

Hope this helps!

Cheers,
Dash

1 Like

image

I am still not able to understand it. :frowning:
Like i need to understand from webportal perspective where a user gets to choose one of the two components i have attached. It should be user friendly, in a easy to interpret and from a development side, easy to develop and configure.

Hi @r_jain,

My idea would be to have a component beforehand having the user choose between the two options “Email” or “Download locally.” These options would be in a Single Selection Widget. Then I’d use a Rule Engine Variable node (since I’m using a CASE Switch Variable node) to convert the choices to numeric variable inputs that would identify which output port should be activated:

If you want to use an IF Switch node instead of the CASE Switch Variable node that I’m using, @bruno29a provides a great explanation of how to use it in this forum post: Controlling IF Switch Node , by a variable - simple case

If you’re new to using Switches in KNIME I’d also recommend watching this quick overview video: Switches in KNIME Analytics Platform - YouTube

Cheers,
Dash

1 Like

Thanks,

I will try that one. In If Switch, it goes with top and bottom i guess rather than 1 and 2 and from a user who is not technical, it will be a bit cumbersome to request someone to write top and bottom to run specific features. But i will try the single selection to get the input.

I wish it was sort of easy to configure this like it’s in alteryx.

Hi @r_jain,

You don’t necessarily need to have the user input “top” or “bottom” or “1” or “2” to run specific features. In my example I have the user choose from pulling data from the “KNIME Server”, a “Database”, and “Cloud Storage” (which I’m getting from the Single Selection widget). Then behind the scenes I’m converting the values to correlate to the correct output port of the CASE Switch node. For a user on the Webportal they should be able to choose from the dropdown what action they want to take and then be taken immediately to the corresponding component after the CASE Switch (Start) node.

Hopefully this helps!

Cheers,
Dash

1 Like