Comparison with 0,05 cents of leeway

comparison test 1.knwf (19.5 KB)
Hello i am trying to work a Knime where multiple of our documents have similar prices BUT some times it has a problem where one has a cent more or less so i would like to know if there is a way to join them in a way where i have a leeway of 0,05 (still maintaining the original values since they are locked with our system and if i change them i cant import afterwards)
made this small example where only the last line should not be joining
thank you for your time

You join on Code and value?
Have you tried rounding

1 Like

cant really round them mostly because it could round more what i want, example i have the value 1,13
and 1,10 if i round up it would become 1,2 while 1,10 would keep the same and then they dont meet, so i would like to see if there is a way to just add the leeway into some kind of joiner or something like that BUT yes if in the end we cant i will just have to bite the bullet and just round up and any mistakes fix by hand really

@bleck, there isn’t a way of using the joiner directly to match based on a range/non-equality but there are things that you can do.

Attached is a Workflow demonstrating some ways to perform a join where part of the join condition is not based on perfect equality.

The Joiner node can only join using “equal”, so the joiner can be used to perform the part of the join it can produce, and then other standard nodes can be used together to filter those rows that match the remainder of the condition, in a similar way to a Rule Based Row Filter would work. In some cases a Rule Based Row Filter could be used here, but where calculations are required, the Rule nodes are not capable of the required matching, so String Manipulation or Math Formula nodes can be utilised instead.

Another option is to use Math Formula to provide the lower and upper range boundaries for one of the values and then use a Rule-Based Row Filter to keep only those rows where the other Value is within that range

So those are options I can think of using the standard nodes, and they may well suit your needs. I always enjoy trying more “exotic” options though :wink: and here I will demonstrate some custom components, which might be overkill for what you are doing here but if you know SQL and your conditions are a little more complicated, they may be able to assist you.

First off I have a custom component that can be used to provide a “custom condition” using an SQL condition compatible with the H2 database.

This allows the single condition to be entered, without using the Joiner node:

And a further possibility, for greater flexibility (and even more “exotic” :slight_smile: ) are components that turn the KNIME tables into database tables, allowing the query to be written using DB Query nodes:


These are still “slightly experimental”, written recently in response to a forum feature suggestion but they should do what you need.

Another “standard node” option… after the Joiner, you could calculate the absolute difference using Math Formula and then apply a row filter:

(workflow updated)
comparison test - options for non-equi row-match.knwf (943.0 KB)


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