Attribute data points from X-table with intervals in Y-table

Hello KNIME Community,

I need assistance with the following task. Your help is much appreciated.

I am trying to add a column from a table with interval data to a table with point data. If the point in X-table lies within the range of Y-table, a corresponding status is being appended from Yi to Xi.

In my example, I’ve got 4 differend items passing through 3 stations at a certain time (points). In the second table there are records of events taking place in the background that last for some time (ranges). A desired outcome is the first table with corresponding records from the second one.

This is what I’m getting (pls see my workflow in the attachment). Highlighted rows are unwanted permutations - obviously, my script in the rule engine is flawed.

This is what I need:

expected

  • PN3 and PN4 at the st_2 did not encounter any event, it is normal and I need to keep them.

alert_ex.knwf (15.8 KB)

Welcome to the forum @Denkorch,

The approach I used was to convert each row of the EVENTS table into a rule using a String Manipulation node.

image

After this, I used a Rule Engine (Dictionary) node to apply the rules to the PRODUCTS table

image

3 Likes

@elsamuel thank you so much for a quick response and a great solution :slightly_smiling_face:

I’ve been experimenting with the same approach but had problems with feeding the rules into the Engine. I have manually changed start/end columns to type string in the second table - instead of using string() in the Manipulation node - but for some reason the Rule Engine Dictionary failed to accept my rules column from Manipulation node exiting with errors. Apparently, there was another mistake in my script.

Anyways, I was close which is already encouraging, but your solution finally ended my struggle :handshake:

2 Likes

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