# Ignition Expression Tag - Switch Expression Function

**URL:** <https://forum.inductiveautomation.com/t/ignition-expression-tag-switch-expression-function/80480>\
**Category:** Ignition\
**Created:** [October 13, 2023, 10:21pm UTC](https://forum.inductiveautomation.com/t/ignition-expression-tag-switch-expression-function/80480 "2023-10-13T22:21:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Choi](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David\_Choi](https://forum.inductiveautomation.com/u/David_Choi)\
**Post date:** [October 13, 2023, 10:21pm UTC](https://forum.inductiveautomation.com/t/ignition-expression-tag-switch-expression-function/80480/1 "2023-10-13T22:21:40Z")

</div>

Experts!

I need your help in understanding why I can't have multiple cases for one result.

[https://docs.inductiveautomation.com/display/DOC81/switch](https://docs.inductiveautomation.com/display/DOC81/switch)

This documentation shows how I can use the switch statement, so for one of the tag, I'm trying to create an expression tag that looks like this:

switch({[default]RFID\_Trial/Department},  
{[default]RFID\_Trial/Department\_list[7,0]} || {[default]RFID\_Trial/Department\_list[8,0]},  
"Engineering",  
"Unauthenticated")

Is this just the limitation of the Ignition itself, or am I having a wrong syntax?

Your help is much appreciated, thank you!

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 13, 2023, 10:32pm UTC](https://forum.inductiveautomation.com/t/ignition-expression-tag-switch-expression-function/80480/2 "2023-10-13T22:32:43Z")

</div>

That's equivalent to,

```auto
If({[default]RFID_Trial/Department} =
    {[default]RFID_Trial/Department_list[7,0]} || 
    {[default]RFID_Trial/Department_list[8,0]},
    "Engineering",. // if true.
    "Unauthenticated". // if false
)

```

Is this what you really want?

The `case` syntax is easier to read than switch.  
[https://docs.inductiveautomation.com/display/DOC81/case](https://docs.inductiveautomation.com/display/DOC81/case)

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [October 13, 2023, 10:51pm UTC](https://forum.inductiveautomation.com/t/ignition-expression-tag-switch-expression-function/80480/3 "2023-10-13T22:51:00Z")

</div>

Probably best to use case and this:

```auto
case({[default]RFID_Trial/Department},
     {[default]RFID_Trial/Department_list[7,0]}, "Engineering",
     {[default]RFID_Trial/Department_list[8,0]}, "Engineering",
     "Unauthenticated")

```

---

<div class="post-metadata">

**Author:** ![David\_Choi](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David\_Choi](https://forum.inductiveautomation.com/u/David_Choi)\
**Post date:** [October 13, 2023, 10:54pm UTC](https://forum.inductiveautomation.com/t/ignition-expression-tag-switch-expression-function/80480/4 "2023-10-13T22:54:25Z")

</div>

Thank you,

But I do want to avoid the use of If-Elseif-else logic in my application for this one, because there's going to be 10 result outcomes I need, with each result having 2-10 conditions for each result.

It could end up getting into a nested ifs also.

---

<div class="post-metadata">

**Author:** ![David\_Choi](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David\_Choi](https://forum.inductiveautomation.com/u/David_Choi)\
**Post date:** [October 13, 2023, 10:59pm UTC](https://forum.inductiveautomation.com/t/ignition-expression-tag-switch-expression-function/80480/5 "2023-10-13T22:59:44Z")

</div>

On second thought... I think it would still look ugly with case ☹  
I'll stick with if statements.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 13, 2023, 11:17pm UTC](https://forum.inductiveautomation.com/t/ignition-expression-tag-switch-expression-function/80480/6 "2023-10-13T23:17:40Z")

</div>

Just to finish the explanation: "OR" in expressions is either logical or bitwise--it never assembles a list of values for another operator to act upon. (This is true in python, too.)
