Forum Discussion
Switch with compare Values Text
- 1 year ago
hello patL
how about this (not sure if this will work since i dont test it out).
TierBreakdown =
SWITCH(TRUE(),
[Value]="D"&&([Value]="A"||[Value]="B"||[Value]="C"),"increased
[Value]="C"&&([Value]="A"||[Value]="B"),"increased",
[Value]="B"&&[Value]="A","increased"
[Value]="A","decreased",
"decreased"Basically SWITCH has same syntax as IF, the first line will be kicked first.
I usually put the most specific statement so it will be kicked first.
Also you need a statement then true value, while false statement will be placed at the very last.
i think line 5-6 dont work because the value has been triggered by either line 3 or line 4.
Hope this will help.
Thank you.
Hi,
it seems the reason its not working is, you cant have both false condition value for each check, you can have false condition value only at the end. The syntax of SWITCH is
SWITCH(<expression>, <value>, <result>[, <value>, <result>]…[, <else>])
Hence at the end of line 4, when you have added "Increase", "Decrease" then it is failing. You can have only 1 ELSE condition at the end of all condition check.
I created a dummy SWITCH to show multiple conditions are working
Hope this helps to resolve your problem. If it does then please mark it as solution.
Thanks - Samrat