If condition on nodes

Hi everyone, i’m newby in knime

I need to be able to achieve the following algorithm, in which, if the DB Reader node marks “empty data” another node will be executed. As in the example below.

image

image

If the node does not contain data, it will run the lower node, but if it got data it will run a later node.

Thank you in advance and if you need more context, don’t hesitate to ask me :wink:

@noe1995 welcome to the KNIME forum. You might be able to adapt this example with a CASE switch:

If you want to catch an error you can use a Try/Catch combination.

2 Likes

Hi @noe1995 ,

Another construct might look something like this:

Exactly how the flows are joined depends on whether the output from both the DB Readers is compatible, and you might need to do something different with them depending on what comes after the CASE Switch End

The NoOp node is an extension from Nodepit Power Nodes. It’s purpose here is to do nothing other than provide a means for connecting an Empty Table Switch data port to the DB Table Selector’s flow port, thus controlling the flow.

If you don’t/can’t use the NoOp node, you can use the Add Empty Rows node instead. Other nodes would also work, but this one is pretty infallible and won’t waste processor! (I just configure it to add 0 additional rows, so that it is doing nothing.)

3 Likes

@mlauber71 and @takbb

Thanks, it was a little confusing at first but both solutions worked great for me.

Really thanks.

2 Likes

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