Bypassing Nodes

Fellow Knimers,

I have a tough question here: I have created a Workflow that allows me to check data for various conditions using rule engines. However, I have run into an issue with this. Some of the files do not have all of the headers I have created in the rule engine. This is causing the rule engines to fail and the process to stop. I think an example may be helpful for this issue.

Let’s say in any given file, I may have three columns, “A,” “B,” and “C”. I have to have rule engines on to check certain parameters on all of these columns in case a file is submitted with all three. However, there are some instances in which a file is submitted and only columns A and B are present. Thus, the rule engine for column C fails. I want to make it so that I can bypass the rule engine for column C and give an output file.

How can I do this? Thank you so much.

Hi @XBrink -

You could use a Case Switch Data (Start) node - and its corresponding End node - to set up a few different options for processing your files.

Here’s an example workflow to get started:

https://www.knime.com/nodeguide/control-structures/switches/case-switch

Thanks for the help. Do you know of any way that I could make it just skip a the rule engine node if necessary? The hope is that I can avoid creating customized flows for each file as it seems might be necessary with the case switch data nodes.

Perhaps instead of using a Rule Engine node, you could employ the Java Snippet node to set up more sophisticated if-then structures. E.g., if column A exists, then check the parameters; if not, move on to check column B, etc. Here’s an example workflow highlighting several different functions:

https://www.knime.com/nodeguide/scripting/java/example-of-java-snippet

You could do this with a Python Snippet or R Snippet node as well, depending on your preference.

Does that help?