Better support for empty strings

Hi,

Whenever I have cells with empty strings in them, I find it very difficult to manipulate them in KNIME.

i.e.

- No way of filtering them (as row filter/splitter will not accept an empty string).

- No way to replace the empty string (String Replacer will not accept an empty string).

- Missing Values node can not use Empty Strings.

Any suggestions would be most welcome. An "Empty Strings" node like the "Missing Values" node wouldnt go amiss, or better support in existing nodes.

Simon.

1 Like

Thanks for bringing this up again. I have opened two additional feature requests in our tracking system.

Hi,

Yes, its a big issue !!!!

I solve that this way : String manipulation node, toEmpty(xxx), Insert Missing as null, replace column (xxx) 

Not very funny......

 

Cheers

I may be missing something here but the Knime 2.5.2 Missing Value node lets you convert a string column with the missing value ? to a null string by setting the default column for String Values to Fixed Value with nothing in the value box to the right.

 

It is the issue of dealing with empty strings which is the issue, not the issue of dealing with missing values which is well supported.

so having a cell with an empty string is very hard to do anything with. I.e. filtering out the row is difficult, and replacing the empty string for another value is tricky too.

simon.

Simon

Can the Java Snippet and Java snippet row filter nodes do this?

i.e.

return !($column$.equals(""));

in the filter to remove the empty cells

or

return ($column$.equals("")) ? null : $column$;

or

return ($column$.equals("")) ? "This was an empty string" : $column$;

in the snippet to convert them to missing values (or some other 'fixed' value)?

Steve

PS - apologies if this doesnt work - I've not tried but think it should!

Many thanks,

Your first example didnt work, but the other two did. Thanks for the Java assistance!

Simon.

Hi,

I am using KNIME 2.7.1 and I am still experiencing issues with empty strings. I am currently using Java Snippets to replace the values, yet this feels more like a workaround than a solution. I am collaborating with non-developers on the workflows, so using Java Snippets is not an option.

I was expecting the Missing Values node to replace empty strings, instead I found that this works only with special '?' values as mentioned above, which I'm not sure how I am meant to create. My data is coming in from a Database Reader node, so if there is any way to make this produce a '?' instead of an empty string, this should work.

Cheers,

David JM Emmett

David

The special '?' value you refer to is KNIME's way of showing a the java null - I don't know if that helps at all?

Steve

The string replacer can now replace empty strings as of KNIME Desktop version 2.8.

I found "Missing value" node very useful. This will help set value of any String, Integer or Double cells with a default value. Not only that it will help map mean, minimum, etc... Wonderful tool.....:)