How to determine a (string) column that only consists of integers?

I have (for example) three string columns COL1, COL2, COL3 and I want to determine which of these three columns has only integers in all its rows (no strings, empty cells, missing values).

 

In the example below it is only COL3.

 

Example:

COL1(Str)|COL2(Str)|COL3(Str)

abc|123|234

cde||456

wer|4|678

 

Does anyone has an idea how to do this with KNIME nodes?

 

Frank

 

I guess, you are searching for an automatic way for checking the content. The String to Number node can at least be used to manally test it and then filter based on the missing values. More fancy is it to transpose the table, create a collection and process the collection in the Java Snippet - but I am not sure if you want to go this way.

I tried the String to Number node
and got missing values for the cells that do not contain numbers.
But then I want to filter columns based on missing values.

Filtering row is no problem, but filtering on colunns based on missing values in their cells?

I only had a couple of mins but this is what I came up with. It involves using the column list loop start, column rename (regex) and the string manipulation node. This I think will work out about 90% of your problem. I only ran it over 3 columns but it seemed to work ok

Thank you for example workflow that can loop over columns. In the meantime I implemented the following solution:

  • String Manipulator Node with function to Int($column$) and option "replace column" to transfer the integer to an INT cell or generate a missing values if conversion is not possible
  • Transpose Node
  • Create Collection Column Node with option "ignore missing values"
  • Calculate length of generated array via a Java Snippet node (The column with integers in all its cells has a longest array !)
  • Do some filtering
  • Transpose again
  • .... and use the remaining column via Reference Column Filter node and Joiner node to merge this result with the original table