[BUG-13496] System.tag.browse filter by name

Hello,

In my script I’m trying to find a given tag in each instance of a UDT.

For instance, I have a UDT named Machine. Within that UDT I have a tag named Status. I’d like to find each Status tag and iterate through them.

The issue I’m having is with the filter on the system.tag.browse function using the name parameter. When I filter by name I get no results.

What am I doing wrong? I’m able to filter by dataType and tagType successfully. If I remove the name filter I can successfully list out every tag within every instance of my UDT, so I know I’m getting the right data up until the name filter.

Here’s my script.

#get all instances of the machine UDT under the given tag path
AllUDTInstances = system.tag.browse(TagPath, filter ={'tagType':'UdtInstance', 'typeId': 'Machine'})
#print AllUDTInstances
#loop through the results
for UDTInstance in AllUDTInstances.getResults():
	#print UDTInstance
	tags = system.tag.browse(UDTInstance['fullPath'], filter = {'name':'Status'})
	#print tags
	for tag in tags.getResults():
		print tag['name']

Below should work.

TagPath='Path/To/Folder/Holding/UDTs'
tags = system.tag.browseTags(TagPath, filter ={'tagType':'UdtInstance', 'udtParentType': 'Machine'})
for tag in tags:
	subTag = system.tag.browseTags(tag.fullPath)
	for stag in subTag:
		if stag.name=='Status':
			print tag.name,stag.name
1 Like

Yes, that does work. I am wondering though why the filter does’t work. According to the user manual the filter can be applied against the name property. I wonder if this is a bug or if I’m doing something wrong.

Looks like a bug with the name filter. I have added a ticket to fix it. In the meantime, prepending the name filter with a wildcard like so should also work: {'name':'*Status'}

1 Like

This issue was fixed in the 8.0.1-rc1 that was uploaded yesterday (4/23).