3

Does anyone know if it is possible to add a null value to a row in KNIME?

I am trying to use the Rule Engine to remove some values, and substitute them with a NULL.

Regards

Sindre
  • 75
  • 1
  • 6

4 Answers4

2

There is no syntax (as of KNIME 3.4.0) for declaring missing values from Rule Engine nodes. There are workarounds though:

  1. When you specify which case should have non-missing values, the non-matching rows will be missing:

    If no rule matches, the outcome is a missing value.

  2. You can have a column with all-missing values with the proper type and set that column as the outcome, like ... => $missingIntCol$

With the Rule Engine (Dictionary) node the outcome column cannot contain missing values.)

Gábor Bakos
  • 8,982
  • 52
  • 35
  • 52
0

Create a Dummy Null Column with a Rule Engine First and then use another rule engine to program what you need EG. $Example Column$ = "#" =>$Dummy Null" This will replace your # in the Example Column with Null Values

Hopes it helps

0

There is missingValue() function in Column Expressions node which returns missing value in a cell. Column Expressions node is based on JavaScript syntax so following logic is possible:

if(column("column1")=="someValue") //create missing
{ 
    missingValue()
} 
else //take value from colum1
{ 
    column("column1")
}
barbsan
  • 3,418
  • 11
  • 21
  • 28
ipazin
  • 102
  • 7
0

You can use a normal 'Java Snippet': Create the input and output via the lower menu. If you chose the 'replace' option for the output column you can replace the input values directly. Otherwise you have create a new column.

Here is example java code to paste and edit:

if(c_your_input>100)
{
    out_your_input = c_your_input;
}

If the there is no matching with if clauses missing values are automatically created.

tardis
  • 1,280
  • 3
  • 23
  • 48