Background color change based on float value (vision) 8.1

NOOB on scripting.

need help on background color change on different float value.
On a numeric Text box or display label
Tag > Value = green
Tag < value = red.

pretty simple but cant seem to get correct syntax.
IGN8.1 Vision.

I know it can change on abs values on the wizard ( tag property binding) but not decimals.

Thanks.

Style customizer?
https://docs.inductiveautomation.com/display/DOC81/Vision+Component+Customizers#VisionComponentCustomizers-ConfiguringtheStyleCustomizer

3 Likes

Thanks
but i need it on a display label or numeric text box

  • Add a boolean custom property to the component you want to affect.

  • Add an expression binding to that property that looks something like this:

{path/to/tag} < {path/to/limit}

The tag reference might be a property reference instead if you have the tag bound or indirectly bound nearby already (but not as text). Same for the limit reference, and it can be a plain constant, too.

  • Use the style customizer to select your colors for the two states of the boolean, or

  • Add a binding to background color and an if() expression to select the colors.

3 Likes

There are good examples of this sort of thing throughout this post: