Ignition 7.9 tag browse tree filter on tag/udt enabled

I know I need to upgrade to 8.1, and I'm working on that...

but I have a tag tree browser that I'd like to filter and only show if the tags are enabled, but its currently showing all tags. Anyone have any advice?

I'm using the filterTag() script while checking the tag.Enabled property, doesn't currently work.

Show your script.

{Note: a common problem is forgetting to allow folders to be seen.}

thanks for the quick response. here is my code:

def filterTag(self, tag):
	if tag.Enabled == 0:
		return False
	else:
		return True

and a screenshot of the udt showing the disabled tags:
image
leads to this in the tag browse tree:
image


This works if based on name, for example...

def filterTag(self, tag):
	if tag.name == "wp14":
		return False
	else:
		return True

the wp14 udt doesn't show at all now
image


not sure what you mean by allowing folders to be seen.

I haven't done anything with 7.9 in quite some time, but this should be pretty close to what you are needing:

#def filterTag(self, tag):
	if str(tag.getObjectType()) == 'Folder':
		return True
	elif system.tag.read(str(tag.getFullPath()) + '.Enabled').value:
		return True
	else:
		return False

If the object is a folder, the script will show it, but otherwise, it will read the value of the tag's enabled property value and evaluate whether or not to show the tag.

Unfortunately that didn't work. Maybe because I'm using nested UDTs?...

Chances are, something has changed since version 7.9, and since I don't have a 7.9 system set up to test on, I'm simply unable to guide you further.

I can offer a few tips though:
• First of all, the filterTag extension function will probably tolerate some print statements, so perhaps try printing the values being returned to get a feel for what's actually happening.
• Secondly, try right clicking on the enabled property in the tag browser. Copy the tag path and paste it into text editor to see how it is constructed. You are going to have to read the tag using this path to get the proper value, so once you figure out how to construct the proper path as a string, you should be good to go.

if tag.getCurrentValue().getQuality().getName() == 'Bad_Disabled':
	return False
else:
	return True
1 Like

@jespinmartin1's solution worked for me on version 8.1, but I still had to add the following to get through the subfolders to see the disabled tags:

	if str(tag.getObjectType()) == 'Folder':
		return True