Scripting to remove error overlays on components

I know there is the option to remove overlays on bindings, and I think there’s a scripting function to remove them altogether, but I was wondering if there’s a way to remove them on select components. Sometimes we will put in components for future equipment, but because those usually require a tagpath, and the tagpath we give it doesn’t exist, it has a few overlays. I’d just like to remove those based on a template property or something like that. Anyone have a way to do that?

Would forceQuality help you out?

https://docs.inductiveautomation.com/display/DOC79/forceQuality

I think that may be an option, but it’d be modifying a lot of expressions, and wouldn’t work on some things like direct bindings.

Here’s a thought I just had, haven’t tested it but perhaps if I get all the bindings for a component and its children (recursive) then I can set the property that would normally be set by the binding edit window.

I would just create a dummy set of tags or UDT for the equipment that isn’t installed yet.
Then you could just point the new controls at a dummy tag set instead of having to modify all of your control structure.

Think I solved it. I can just set the quality of each component to good (-1). From my tests so far, they should all update to their correct values when the bindings re-evaluate which is good, so once a real value is put in, it’ll re-evaluate and clear the forced-good qualities.

def forceQuality(cmp, qInt = -1):
	cmp.setDataQuality(qInt)
	for child in cmp.getComponents():
		forceQuality(child, qInt)

forceQuality(self.parent)	
2 Likes