Match string issue

ignition 8.0.2

Hi All.

I have a template called "Analog Input". It has a custom property for the tag path and it displays the value of the tag and auto populates the mouse over text. This all works great.

I am struggling with the syntax for colouring the background based upon the tag quality.

I have added the following expression to the background colour of the object in question. The code compiles but does not work.The code is supposed to colour the object grey if the "Quality" string is equal to "Good". However, the value is always red regardless of the status.

if(tag({Analogue_Input.TagPath}+".Quality")="Good","223,222,222","255,0,0")

Please can someone explain why this doesn't work?

Best regards.

Because quality is an object, not a string. It gets converted to string when displayed, giving that impression, but comparison doesn’t implicitly convert to string. Consider using the IsGood() expression function.

2 Likes

Perfect! Thank you.