Hi everyone, lets say I want to make an If statement like the following
If [Column Z] = "H" and [Column A] = ([column B],[column C],[column D],[column E],[column F],[column G],[column H]) then "X" else "Y" endif
How would the syntax work for this in alteryx? Without doing some sort of gigantic string of elseIf's?
The idea of course being that if column Z contains the value "H" and column A is equal of any one of lets say 10-20 columns.
Thanks
Solved! Go to Solution.
I would do this
If [Column Z] = "H" and (
[Column A] = [column B]
or [Column A] = [column C]
or [Column A] = [column D]
or [Column A] = [column E]
or [Column A] = [column F]
or [Column A] = [column G]
or [Column A] = [column H]
)
then "X"
else "Y"
endif
It feels a bit long, but you're only writing it once :)
Nice solution @AGilbert I was thinking about IN when I posted mine, but I didn't have the time to test.
Your filter is interesting though, I never write the full IF syntax in a filter, I just use the raw condition like this (but either way works):
[Z] = 'H' and [A] in ([B],[C],[D],[E],[F],[G])
@cmcclellan I agree that the full if statement is unnecessary. I should take time to tighten up my logic blocks but sometimes the ideas just fly, ya know!?
Thanks @AGilbert , an "IN" statement is exactly what I was looking for.