Column compare

Hi everyone,
Ist there any Node, which can compare two columns from different tables. Und deso in one of them some changes?

Thanks

Hi there!

Not sure you can do it only with one node but you can do following:

  • first filter only column from interest from one od tables using Column Filter node
  • then use Column Appender to add that column to other table
  • use Column Comparator node to compare two column (or Rule Engine if you prefer) and new column will be created
  • now if you do not need columns you were comparing using Column Filter node again just drop them

Assumption is you are aiming for a row wise comparison :slight_smile:

Br,
Ivan

Thank u i did what u wrote. But i think i should use Java Snippet because i want compare each value with all the another in the second Column. But i have a small problem, can i use the column like arrays in java to know those value in a concrete save place . For example “c. Device[i]”

Thanks

There are number of ways to do comparison in KNIME. To provide a better advice it would be useful to see your input and expected output data.

1 Like

KNIME_project.knwf (18.6 KB)

Here is my Work flow :slight_smile:
My problem is in my code i try to use tge columns like array in java but it does not work.
Could you please help me or give me another idee to do that. I want to compare the column supplier with supplier1 and device with product and if they the same i would change the price column

Your workflow doesn’t contain data. Please provide couple of rows to see the structure. According to your Java snippet code you may try Column List Loop but still with the data structure it could be a simple solution.

KNIME_project.knwf (12.7 KB)

Ah okay sorry. And this one?

Hi Hussein!

There is no data in it. You have reset workflow before export. Don’t do that and there will be some data :slight_smile:

Br,
Ivan

KNIME_project.knwf (81.7 KB)

Hi Ivan
There should be data now :smile:

1 Like

Hi Hussein!

There is data now :smiley:
I have checked it and I suggest using Joiner node. Join mode is Inner Join or Left Outer Join depending how your final data set should look like. After joining you can use Rule Engine node to preform price modification according to your logic.

If you will have additional question just ask.

Br,
Ivan

Hi Ivan,
Thank u i think it works now
But i have a question to be sure. Joiner compares the rows and show only the rowsbwith the same value is that true?
KNIME_project.knwf (54.3 KB)

Hi Hussein!

Seems like it works :slight_smile:
Joiner node joins depending on the Join mode you have chosen.

Here is a link regarding joins so take a look: https://www.dofactory.com/sql/join

Br,
Ivan

1 Like

Hi Ivan,

i have now another Question. is there any Node, what counts all values in one column und put it in a new row ?

thanks
Hussein

Hi Hussein!

Sure. But for keeping our forum clean please create a new topic and try adding an example for your question :slight_smile:

Br,
Ivan