I am trying to write a if else logic
howerver the logic seems to fail. The and condition statements don’t seem to work for me. I am referring to all string fields. Do we have a simple if else way to do things since this is frustrating.
my logic is
(column(“a”) == “abc” && column(“b”) in (“def”,“ghi”)
The logic doesn’t throw an error but it gives a ? in the result. I don’t know how i can troubleshoot it.
For such a string comparison, you need to use
If this does not work out then please share a sample of your dataset or the workflow.
For in (“abc”,“def”) equals doesn’t seem to work. What can i use for it?
I saw you changed that just after my reply I would change to the Rule Engine for the IN statement.
This is a bit frustrating but nevertheless thank you
How about the below? In a brief bit of testing this worked for me:
if (column("a").equals("abc") && contains(column("b"),"abc","w") || contains(column("b"),"def","w"))
Thanks Scott for your response.
Unfortunately, i have 50 odd strings that are supposed to be equated with. The easiest i could think was using the IN operator.
The solution which you mentioned, while it works but its really cumbersome to write as the number of strings to be matched with increases in number.
I hope the newer versions of KNIME do tackle this and make it easier for the rest.
Try to use Rule Engine Dictionary. This way you can add or remove necessary words dynamically.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.