Hello Everyone,
I have just started my KNIME journey. I know that using string Manipulation node we can change a string Value to null. I have a column PORT which has multiple strings (OTHER, NONE, To be decided) which need to be converted to missing value (null). Is it possible to use a single node to do them all together instead of using the String manipulation node many times? These are on single column not on different column .
Thanks in Advance, any pointers will be much appreciated.
You can use Rule Engine β KNIME Hub and use the fact that if no rule matches, the result is missing.
For example:
NOT ($PORT$ IN ("OTHER", "NONE")) => $PORT$
Another solution would indeed be the String Manipulation.
You can always nest functions like this:
toNull(replace(replace(replace($PORT$, "OTHER", ""), "NONE", ""), "To be decided", ""))
The Rule Engine might be more convenient though
Thanks I used both the methods and they both worked, but like you said the Rule engine is more convenient. Also I was wondering if these values are not in caps or the string is different Like None and none can we perform the same operation using βNONE*β, will it work.
The Rule Engine does not have an option to ignore case but you can use the String Manipulation node beforehand to turn everything into lower / uppercase using the
toLowercase()
or toUppercase()
functions.
Thanks help is Much appreciated
But regular expressions have, so you can use the (?i)
modifier with the MATCHES
rule:
NOT $PORT$ MATCHES "(?i)(none|other)" => $PORT$
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.