I am trying to change color of the progress bar based on a value. Should be green when its greater than 0 and when greater than the low set point, yellow when it's over the alarm setpoint, and red when it's over the shutdown setpoint. I have the script shown below but it isn't working how I need it to.
Please review:
if((tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke') >= 0), color(71,255,71),
if((tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke') > tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke-Low')), color(71,255,71),
if((tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke') > tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Alarm')), color(255,255,0),
if((tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke') > tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke-Shutdown')), color(255,0,0),
color(128,128,128)
-
Please tag your question as
vision
orperspective
. You're using thecolor()
function which only works in Vision. See the note in color | Ignition User Manual. -
I have the script shown below ...
That's an expression, not a script. (Technicality but an important one.)
-
... but it isn't working how I need it to.
What is it returning?
- What property of the component has this expression binding?
you shouldn't be using the tag function, you should be creating custom properties and binding your tags to those, then using the custom props in your expressions. Using the tag function has performance drawbacks. You should only ever use these in expression tag expressions
1 Like