Subtraction with missing value in column expression node should lead to missing (result) value

Hi Knime-Community,

the following problem: In the column expressions node I have performed a calculation (x-y)/x.
If y has a missing value, I get the value 1, as if y was counted as 0. But if y has a missing value, I would like to have a missing value in my result column.
I now see two possibilities:

  1. Either tell the formula to only calculate if y is not a missing value,
  2. or formulate an if-condition in a sequence node, so that if there is a 1 in the rows of the result column, it should make a missing value out of it.

However, I can’t get either of these to work. Does anyone have an idea for one of the two approaches? Or a completely different suggestion for a solution?
This would be great :slight_smile:.

Thanks a lot

I’d start with trying the following expression in the Column Expressions node:

{ missingValue() }
{ (column("x")-column("y"))/column("x") }
1 Like

Hello @Christian_Essen,

Column Expressions node is based on JavaScript. See here on JS handling of null (and undefined) values:

(Internal Reference: AP-14016)


@elsamuel: Thank you very much, it worked great :upside_down_face:.

1 Like

@ipazin: Thank you very much for the additional explanation :slight_smile:.

1 Like

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