If switch and reading different files

#1

Hi,
I have a scenario where I want to detect duplicate values, and if no duplicate values are found, read one file. If duplicate values ARE detected, read a different file. Is this possible with the Switch nodes? If so, how would it be set up? No Read nodes have an input port, so I’m not sure what to connect the output of my Switch node to.

Thanks!

0 Likes

#2

You can use variables port.

1 Like

#3

Hi @Snowy

I don’t think you need an If Switch node. It is possible to do it using flow variables. if_switch_different_files.knwf (95.1 KB) In this example the Row Filter (choose (no-)duplicate) can be left out, because the Table Row to Variable node expects the output of your scenario (yes or no duplicates).

2 Likes

#4

Here’s another option in case you wanted to play with switches…

4 Likes

#5

You could use the Vernalis Flow Variable IF Switch (Flow Variable Value) node in place of the CASE Switch node and condense the Duplicate Row Filter and Rule Engine to a single node, and make the configuration very simple:

image

image

(Where the ‘Count*(Universe_0_0)’ variable is the column name of whichever column you choose to count on)

Steve

2 Likes

#6

Thanks, Steve - that is quite nice!

1 Like

#7

Thanks @ScottF - we have the equivalent node for ‘normal’ IF Switch too - it saves the almost invariable need for an Edit Variable node to create a variable to control the output port :slight_smile:

(Search for (Flow Variable Value) on the hub and you should find it)

Steve

2 Likes