System.tag.browse() can't get it working with wildcards

results = system.tag.browse (path = '[default]', filter = {'name': '*M*'})
for result in results.getResults():
print result

The above script is copied from the online user manual.
After changing the 'name' filter from '*M*' to '*a*' and de code is executed we get some results.
However, after changing the 'name' filter from '*a*' to '*aa*' we don't get any results (there are some tags available with 'aa' in their tagname).
Can someone give us a push in the right direction to solve this problem?

You using the wrong quotes. Use regular single quotes, or double quotes.
like this

results = system.tag.browse(path = '[default]', filter = {'name': '*M*'})
for result in results.getResults():
	print result

EDIT:
Also, using just [default] as the filter, it will only look at tags and folders directly in [default]. If your tags are in a folder, then you need to specify path = '[default]folderName/subFolderIfNeeded'

Thanks!

Hi, I have the same problem but with the ‘typeId’ property. When I give the entire name of the UDT type it works, but when I’m using the wildcard then it doesn’t return anything.
I have two UDT that have almost the same name (UDT_H2O2_Filtration and UDT_CLO2_Filtration) and then I tried to write the following filter in argument of the function to retrieve all instances of these 2 UDTs but it returns an empty array :

filtrations = system.tag.browse("[Moutounade]Moutounade", filter = {'tagType':'UdtInstance', 'typeId':'*Filtration'})
	return filtrations

But when I put this filter, then I have results :

filtrations = system.tag.browse("[Moutounade]Moutounade", filter = {'tagType':'UdtInstance', 'typeId':'UDT_H2O2_Filtration'})
	return filtrations

Do you know why ?

Where did you get the idea you could use wildcards in the tagType filter? It is only documented as applicable to the name filter.

1 Like

I though it was possible as it is also a string. But thanks for your answer.