Rule Engine Variable

Hello,
I would like to use the Rule Engine Variable as described here:


I am failing in defining the rules, as I am not into the expressions.
It should be:
If column “molecules” exist => 0
else => 1

0 and 1 should be index values that tells CASE Switch Data (Start) what to do.

Thanks for your help.

Hi @Raphael_Klein and welcome to the KNIME community forum,

To check whether a column exists or not, you can follow these steps:

  1. Use the Extract Column Header node

  2. Aggregate headers as a list by using the Column Aggregator node

  3. Check if the column exists in the list and create the port value in the Column Expressions node using this expression:

if(arrayContains(column("List"), "molecules")) "top"
else "bottom"

Here is an example workflow:
26320-1-1.knwf (13.9 KB)

:blush:

6 Likes

Hei @armingrudd thanks for the welcome and your help.
It works like that. :smile:

2 Likes

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