So, apparently I need to logically write out my question for this group to answer my own question. Who knew posting here would be so therapeutic?!
Original Q: I’m trying to make it more obvious for operators which asset(s) are contributing to an alarm by highlighting them on main screen that shows an overview of the process. I’ve used if()s nested inside a concat() before for handling strings, but I’m getting warnings with toColor() of the kind, “Cannot coerce string value ‘nullnullnullnull’ into a color”
This was the offending code:
// Expression to turn background of button depending on alarm severity
if ({Chiller_Is_Active},
concat (
if ({Condition1},
toColor("Orange"),NULL),
if ({Condition2},
toColor("White"),NULL),
if (Condition3},
toColor("Yellow"),NULL),
if (Condition4},
toColor("Red"),NULL)
),
toColor("White") // Default
)
Then I realized I was after the coalesce() function and I just needed to switch the colors names themselves
// Expression to turn background of button depending on alarm severity
toColor(
coalesce(
if ({Chiller_Is_Active},"White",NULL), // default, unless alarm
if ({Condition1},"Orange",NULL), // bad
if ({Condition2},"White",NULL), // okay for our purposes
if (Condition3},"Yellow",NULL), // suspicious
if (Condition4},"Red",NULL) // awful
)//coalesce (not concat, you nincompoop!)
)//toColor
Are there better ways to do accomplish same effect?