I’m trying to figure out the best way to handle a template overlay. The image below shows two instances of the template, the first instance is bound to an active tag the second instance is bound to an inactive tag, hence the Disabled overlay. The tags are bound to a float type custom property on the template.
Ideally I would like the template to display all overlays except Disabled, and if the overlay is Disabled it would hide the numeric value and display “N/A” instead.
I did talk to tech support and was advised to try a property changed event on the template to get the template’s dataQuality. I was able to do this, but the problem is that no property changed events get fired if the template is bound to an inactive tag, plus I’m not sure if it would be possible to do anything other than hide the template if the dataQuality was 410, which isn’t ideal.
Won’t you get a property change event in the template itself when the binding changes? If so, you could probably evaluate the quality of the bound tag and show or hide the label that you are using to display it’s value. Place another label underneath with no binding that always reads “N/A” so that if the tag label is hidden the template displays “N/A” with no overlay.
The problem is that the template is bound to a UDT property on the window, it’s actually the window’s UDT property that is getting changed. Even so I would think that a property change event would be fired on the template because the template’s dataQuality is being changed, but there is not property change event being fired.
Another thing I noticed is that the dataQuality isn’t being sent down to the numeric display either. In the image below the top item is a container with a dynamic property that is bound to a disabled tag, the numeric display is bound to the dynamic property, notice how the numeric display’s dataQuality is 410. The bottom item is the template set-up the same as the container, template has a dynamic property that is bound to a disabled tag, the numeric display is bound to the dynamic property, but notice that the numeric display’s dataQuality isn’t 410, it’s 192, even though the template is showing the dataQuality to be 410. Also when the template’s dataQuality is changing there is not property change event being fired.
Figured out the solution. I placed the following script in the propertyChange event of the instance of the template
#hide the template if the dataQuality is 410 (Disabled)
if event.propertyName == "dataQuality":
if event.source.dataQuality == 410:
event.source.visible = 0
event.source.visible = 1
I tried putting a script in the propertyChange event of the template itself, but the propertyChange event doesn’t fire when I expected it to, like when the dataQuality of the template changed