Hi all! Just wondering if I can get some direction on how to solve this issue. I need to convert rows with underscores into the word “Null” (not a missing value).
I have tried many different ways to try and solve this, and this is the closest I have gotten. However, it changes ALL the rows into “Null”, which is not what I am after.
Of note, one of the groups in the row has a singular underscore. So I assume I will need to use a rule that only changes the row if it starts with an underscore?
Hi @ConfusedStudent and wellcome !
“rows with underscore” suppose rows with underscore somewhere in it and not necessarly rows which are exactly one underscore : this is the meaning of the condition $Occupation$ = "_"
and if it don’t match (ie none of the rows are equal to "_"
), the second condition apply so are transform to Null. If you want to apply Rule engine (I suppose that this is your screenshot), you have to use wildcar and use LIKE "*_*"
.
Otherwise to suppress or replace a specific caracter, use String manipulation node with replace(), replaceChars() or removeChars() according to what you want.
Best,
Joel
Hello @ConfusedStudent and welcome to the KNIME Community
You can test with the ‘Rule Engine’ node with the negation MATCH() function, MATCH is currently supported with regex. Or in the same way a negation of LIKE() as a wildcard can work too.
Test this code:
NOT $Occupations$ MATCHES ".*_.*" => $Occupations$
TRUE => "Null"
NOT $Occupations$ LIKE "*_*" => $Occupations$
TRUE => "Null"
BR
This is it, thank you SO much!!!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.