Boolean widget issue

I use the boolean widget, outputting an integer as I need 1 or 0 for a given node. But I also need from the same boolean widget node a boolean type false,true output for another node. Can I somehow convert the integer boolean output to a boolean type (false,true)? If so, how?

Hi @MelanieTU , ok this was a surprise, and not a good one.

My go to “obvious” solutions were Rule Engine (variable) and String Manipulation (Variable). They should have been able to do the job in my view… but :open_mouth: I was surprised by the results!

Rule Engine (Variable)

Fail! It cannot handle the creation of a Boolean variable. Unlike its non-variable counterpart, it simply refuses to create Booleans!

**String Manipulation (Variable) **

Fail! It all looks fine. The Boolean(x) function should achieve exactly what we want… but when we run it…

String Manipulation (Variable) cannot, it seems, generate a Boolean variable! This looks like a bug to me, since the function is allowed syntactically.

So I looked at Java Edit (Variable) … it can’t create a Boolean either.

and I looked at Variable Expressions.

Fail! It can evaluate an expression to true or false, which looked promising, but again it cannot generate a boolean variable type. :frowning:

I considered turning the logic round so that the Boolean Config generates a boolean that we turn into an integer, but none of the above nodes can even “see” the boolean variable… :open_mouth:

It would appear that Booleans are not well served by the variable-specific nodes! I’d never noticed this before. I’ve only tried this out in KNIME 4.7. I haven’t tried it in KNIME 5.1.

The workaround to me then is to turn the variable into a row/column, deal with it…

using Rule Engine:

or using String Manipulation:

and then turn it back into a variable.


My new component :wink:


It works, thank you!

1 Like

Great component idea @takbb !


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