# Rule Engine (Multi Column)

**URL:** <https://forum.knime.com/t/rule-engine-multi-column/77952>\
**Category:** Feedback & Ideas\
**Created:** [March 17, 2024, 1:47pm UTC](https://forum.knime.com/t/rule-engine-multi-column/77952 "2024-03-17T13:47:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![takbb](https://forum-cdn.knime.com/user_avatar/forum.knime.com/takbb/32/57077_2.png) [@takbb](https://forum.knime.com/u/takbb)\
**Post date:** [March 17, 2024, 1:47pm UTC](https://forum.knime.com/t/rule-engine-multi-column/77952/1 "2024-03-17T13:47:20Z")

</div>

Just putting this out there… 🕶  
It would be great if this could appear as a core node!

In the meantime here is a component:

> **[Rule Engine (Multi Column) – takbb](https://hub.knime.com/takbb/spaces/Public/Components/Rule%20Engine%20(Multi%20Column)~9JGA1Tb_ZYHgj9Cu/current-state)**
>
> Provides Rule Engine functionality across multiple selected columns. Rules are based on those written for the core Rule Engine node. There is a small change to…

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/1/0/101c0e8de08f1948d20c87bdb0d7dcbe8f0ed212.png)

**Use Case example:**  
[Setting all ZEROES to MISSING](https://forum.knime.com/t/replacing-0-values-with-null/77942/2):  
`NOT $CURRENTCOLUMN$ = 0 => $CURRENTCOLUMN$`

**Limitations**

- Mostly usability; there are also limitations on the UI for a component.

- It is best to execute the component before configuration so that it can “see” flow variables and column names. This is a limitation of the component architecture.

- Use keyboard shortcuts to copy and paste flow variable and column references from the lists onto the Rule text area.

- There may be some instances where the datatype is changed as a result of the application of the rules. I have attempted to coerce datatypes back to the original where possible, but this may not always work.

**More details**  
See component documentation for details. The internals of the component are spaghetti at the moment and I’ve left a couple of additional nodes in there for debug purposes. I may tidy that up at some point… But then again… I may not 😉

**Feedback**  
Please tag me on the forum with any feedback/ideas/issues.

It would be nice if the list of columns and flow variables could be made smaller but I think there is a **#bug in the Single Selection Configuration node** - it is not respecting the “Limit number of visible options” for a List selection:

![image](https://forum-cdn.knime.com/uploads/default/original/3X/3/6/3685d74e524039dbb69a968c26c625d0cdf0512e.png)

No matter what I set it to, it just creates a list box with every row displayed.

* * *

edit: some thoughts I have in mind for possible future update:

- The ability to refer to other columns by offset from CURRENTCOLUMN
- Be able to refer to flow variables using exact same syntax as rule engine
- Ability to refer to CURRENTCOLUMNTYPE so that rules could differ according to the datatype of the current column
