Ignition Expression Tag - Switch Expression Function


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


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:

{[default]RFID_Trial/Department_list[7,0]} || {[default]RFID_Trial/Department_list[8,0]},

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

Your help is much appreciated, thank you!

That's equivalent to,

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

Is this what you really want?

The case syntax is easier to read than switch.

Probably best to use case and this:

     {[default]RFID_Trial/Department_list[7,0]}, "Engineering",
     {[default]RFID_Trial/Department_list[8,0]}, "Engineering",
1 Like

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.

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

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.)