Row matching and judge

Dear KNIME community,
Col1 Col2 Judge
True True True
True ? False
? ? 0
i would like to make a judgment if col1 and col2 bothTrue then the Judgement is True
if col1 True col2 ? then Judgement is False
if both col1 ? col2 ? then Judgement is 0
how to make it in KNIME?
any help greatly appriciated

Hi @Vaamen , it is unclear what your data types are and whether the “?” represents a physical “?” or a missing value.

You can achieve this with the Rule Engine. If the ? means “missing value” then it could be done as follows:

$Col1$ = "True" AND $Col2$ = "True" => "True"
$Col1$ = "True" AND MISSING $Col2$ => "False"
MISSING $Col1$ AND MISSING $Col2$ => "0"

If ? is a physical “?” character, then it could be achieved with:

$Col1$ = "True" AND $Col2$ = "True" => "True"
$Col1$ = "True" AND $Col2$ = "?" => "False"
$Col1$ = "?" AND $Col2$ ="?" => "0"

If Col1 and Col2 are actual booleans (I would think not because boolean true/false column values are represented in lower case in KNIME), and the ? is missing values, you could do it with:

$Col1$  AND $Col2$  => "True"
$Col1$  AND MISSING $Col2$ => "False"
MISSING $Col1$ AND MISSING $Col2$ => "0"

Note that the output for “Judge” is assumed to be a String in all cases, since you are mixing “True”, “False” and 0, which means that the Judge column can only be represented as a String.

Also note that the output for Judge is undefined if other combinations of Col1 and Col2 were to occur.

I’ve just realised a further interpretation of your question could be that ? represents “any value”. In which case it could be achieved using the following rules:

$Col1$ = "True" AND $Col2$ = "True" => "True"
$Col1$ = "True"  => "False"
TRUE => "0"

If Col1 and Col2 are physical booleans then:

$Col1$  AND $Col2$  => "True"
$Col1$  => "False"
TRUE => "0"

Hi @takbb ,
thank you very much for your elabrate answer. I m sorry i forget to say ? are missing values .
i really appriciated your time

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