Hi. I have some complex coding to do that seems best tackled using nested if-then statements.
For example, if I am coding column A, the logic might look like this:
IF X=1 OR X=2 OR X=3 THEN
IF Y=1 or Y=2 THEN
ELSE IF Y=3 OR Y=4
ELSE IF X=4
ELSE IF Z=2 OR Z=3
This is a simplified example, what I need to do will often go four nests deep.
All of the variables I am dealing with are numeric.
I know how to do this in Excel and SPSS, but not sure the best way in Knime.
I have seen Java Snippet mentioned. Is this in fact my best bet? I am not too familiar with Java, but this is something I will need to be doing often, so if I need to spend some time learning it, I’ll do so.
I’ve used Rule Engine a lot for simpler logic, but I do not see how to do nested logic in that environment… am I missing something?
Thanks for any help!.
EDIT: Looks like I need to figure out how to indent, I see my example is pretty hard to read. I’ll try to figure that out.
So it looks to me like Column Expressions would still entail writing this in Java? I think I mostly figured it out, though I am struggling a bit with how Java is handling missing values. Seems if a value I am checking is missing, it just skips the entire if/then logic.
I have not seen anything indicating how one would set up nested logic in Rule Engine. Can you point me to any examples of how to do this? As far as I can tell, after you check for a condition being true, the only option is to assign a value (rather than start another conditional statement).