Missing Value detection using Java node

Hi all,

I need some help please
I am trying to detect “missing values” presented in a table in KNIME as “?” using Java so that I replace them in a new Column with something else.

String BinA;
String BinB;
BinA = $Column_1$;
BinB = $Column_2$;

if (BinA != null && !BinA.isEmpty()) {
else {
BinA = BinB ;

return BinA;

This never enters the “else” part of the “if” statement
Any advice?


are your question marks in the KNIME table red? They need to be red in order to truly represent missing values. Otherwise you need to check in Java using BinA.equals("?").
Kind regards

Yes they are. I found the issue. There is a checkbox asking to account for Missing as Null. Once I did than then my script worked

1 Like

Hi there @iCornerstone,

if I got it right from your code this can easily be done using Column Merger node or?



Where is that check box?

I am using the Java Snippet and I have red ?.
I wanted to identity them with xxx.isEmpty(), but unfortunately I get the following error message “Evaluation of java snippet failed for row “Row2537”. The exception is caused by line 32 of the snippet.” where line 32 is “… xxx.isEmpty() ;”.

Thank you for your help.


In the normal Java Snippet the checkbox does not exist. Here the missing values (Red ?) are inserted as null and using x.isEmpty() results in a NullPointerException. Just check for null instead.
Kind regards

1 Like

I´m facing similar situation using “java IF (table)” node. After some testing, that´s the way we made it to work. Maybe can help.


1 Like

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