Object color change based on multiple tags

I am new to Ignition and learning so please forgive my ignorance. I inherited this project so there is a lot of existing code and configuration. Right now, we have built a map of our plant as a view in Perspective using shapes and symbols. For a building we have e-stops and faults on machines that we are monitoring.

Based on existing configuration I have consolidated the faults and e-stops into a single expression tag, e.g.:

({[.]Filter5_Airlock_Motion_Fault}) |
({[.]Filter5_Blower_Run_Fault}) | .... etc

I have a custom property ‘estop’ on my building shape which is bound to the e-stops expression tag.
In the Props of the shape under elements/0/fill/paint I have a tag binding to the faults tag, then a script transform,

	if self.custom.estop:
		return 2
	if  value:
		return 1
	return 0

I then have a map transform which returns a color based on which tag is active.

This usually works but sometimes when I load the screen, I get an error on my shape.
AttributeError: ‘com.inductiveautomation.perspective.gateway.script’ object has no attribute ‘estop’

I’m pretty sure this happens because the custom property hasn’t been evaluated prior to running the script every time.

I am experimenting with an expression binding on the paint property to say

if({[default]Filter5/Filter 5 E-Stops}, 2, 0) |
if({[default]Filter5/Filter 5 Faults}, 1, 0

The problem with this solution is that if both tags are true as the same time, the output of the expression is 3 (2 +1).

What is the recommended method of changing the color of an object based on an arbitrary number of tags and colors?

Take a look at the binEnum() expression.

        {[default]Filter5/Filter 5 E-Stops}, 
        {[default]Filter5/Filter 5 Faults}

EDIT: Since it appears that you want the e-stop to take priority, list it first.

Just tested and this works great. Sounds like I am on the right path to use an expression binding and will use this method moving forward.