feasible solution if cell is not empty and the value is greater than .....

Hi,
I need a support. In the below picture, I have to find out decision column. If date is not empty and the value is greater than 5, then OK, otherwise Not OK.
My concept:
if(and(not(isMissing(column(“Date”))),column(“Value”)> 5){“OK”}
else{“Not OK”}
or
if(and(not(column(“Date”)=="")),column(“Value”)> 5){“OK”}
else{“Not OK”}
Both of my concept has same meaning?
And is there any other solution to check if the cell is not empty and value is greater than 5?

image

Regards,
Ekram

Hi @emshihab , in Knime, “missing” usually refers to null, an uninitialized cell, an empty value, while “” is actually an empty string, which is an initialized cell and therefore “” would not read as “missing”.

I’m not sure how the function isMissing() from the Column Expressions evaluates things, if it treats “” as missing, you would have to check the documentation or try it around and see.

To be on the safe side, you can check for both:

if(!isMissing(column("Date")) && strip(column("Date")) !== "" && toInt(column("Value") > 5)) "OK"
else "Not OK"

Note: I added the strip() function to make sure that it also treats " " or " " or " " etc as “”. I also added the toInt() function to make sure that it’s evaluating the column Value as int. Knime could be already treating it as int, just like it could also not - it’s always tricky in this situation. With the toInt(), we’re making sure it’s int.

Have you tried rule engine node?

thank you for your sugesstion

I didn’t try. I used column expression

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