Column filter ?

Hi there,

Just a quick question about how to use KNIME. I need to compare the contents of two different columns, how can I do this in KNIME ?, splitting the output into two new tables, one where the str is found, the other not. For example:

Column1
a
b
c

column2
a
d
c

so comparing column1 with column2, the following would be returned;

Newtable1 (column1=column2)
a
c

Newtable2 (column1<>column2)
d

The column1 and 2 comparison should be not limited to direct cell to cell comparison, but column1 cell1 to column2 ALL cells. But I can also envisage a direct cell to cell comparison function would be useful.

Do you have a node that can accomplish this comparison?, or workflow?

Really great product,

Stanage.

stanage wrote:

The column1 and 2 comparison should be not limited to direct cell to cell comparison, but column1 cell1 to column2 ALL cells. But I can also envisage a direct cell to cell comparison function would be useful.

Sorry, I didn't get it. How would a one-to-all-cell comparison look like for your example? A one-to-one-cell comparison is easy. Simply use the powerful Java Snipped node to append an additional column of type integer such as:
$column1$.equals($column2$) ? 1 : 0

(if column1 and column2 are of type String, in the case of numeric columns just compare the two values by "==") Than use two Row Filter nodes to split up the table into two parts, one contains only the rows matching the '1' the other '0'. For table1 filter out either column1 or 2, and for the table2 column1, and in addition the newly added int column which was just used as an intermediate column for the Row Filter node. Done.

Hi Gabriel,

What I am trying to do is find a value in a column table, ie.

Query str: Table1 column1 cell1 value = a

Find Query str value(a) in Table2 column1.

If found send query string (Table1 column1 cell1 value) to a found table, else send query string to not-found table. So this will effectively filter the input by creating a list of found /not found values in two seperate columns or tables.

I don't have the java skills to code this, and have looked at creating a new node for this function, but I definitily do not have the skills. Any help would be greatly appreciated.

Best regards,

Stanage.

In order to run my example, you need to join (Joiner node) these two columns first into one table, which then is applied to the Java Snippet, two Row Filter nodes ( to separate the data into two tables again) and a Column Filter( to get read of the additional column). Works? We are still thinking about the one-cell-to-all problem...

Hi Gabriel,

I was wondering did you come up with any ideas on the one cell to all problem.

The reason for asking is that I have two columns of unequal length, and need to find the duplicate entries. Is it possible to get the two columns into a java array, and then perform a sort on this (see following thread for the general idea

http://forum.java.sun.com/thread.jspa?threadID=503238&messageID=2382843

).
Anyhow if you can let me have your thoughts on this, that would be a great help.

Thanks in advance,

stanage.