I am trying to write an ‘if contains’ statement. I would like to write the statement in the Column Expressions tool but it does not look like it supports it.
Does the JavaScript IN or INCLUDES work in the Column Expressions tool?
For Clarification I have strings that looks like this (John Smith[Recruiter](Jane Smith)[HR Manager]. My contains would just look for “HR Manager” The LIKE function in the Rule Engine is not picking “HR Manager” out of the string.
Thank you for the reply. For whatever reason the Rule Engine node is not working to identify the “HR Manager” string within the larger string of (John Smith[Recruiter](Jane Smith)[HR Manager]. To make matter worse, the string lengths vary with the piece i’m looking for showing up in different parts of the overall string.
I tried the (regexmatcher) in the Column Expressions node and I think I have the same problem. It’s marking all at true, regardless of the string.
It is may not be simultaneously HR Manager and Recruiter in the same field.
So,
if
(regexMatcher(column(“Req Team”), “ .HR Manager. ”))
|| regexMatcher(column(“Req Team”), “ .Recruiter. ”)) {
‘Yes’
}else{
‘No’
}
So what’s strange is, the regexMatcher is not applying a FALSE or a “No” when the text is not contained in the string. It is putting a TRUE or a Yes for each row in the entire column.
The Rule Engine works with this expression no problem:
$Req Team$ LIKE “HR Manager” OR $Req Team$ LIKE “AB123” => “Yes”
TRUE => “No”
Unfortunately I cannot get the regexMatcher to do the same thing. I just want to keep these statements consolidated in the Column Expression node. I must be missing something!
Hi @izaychik63. My need is to do a ‘Contains’ function and i was under the impression the LIKE was the KNIME equivalent. Is this correct? Do you have an example of how I would use Index to identity text in string of varying lengths? I’ve actually never used the function before. Or if you could point me to a resource