Cant debug Tag Browse Tree filter

This is a really annoying one.
I've read through all the forum posts about how to utilize this filter, and all i really want to do is show realtime tags from specific providers and not others.

So i imagined something like this should have worked:

def filterTag(self, tag):
	showProviders = ["G1Common", "G1LogPP"]
	if "G1Common" in tag.fullPath:
		return True
		return False
	# end if

Based on the fact we should be able to access the following tag object properties:

However nothing is being filtered out.
I can't even get anything printed out to console when doing a simple:

def filterTag(self, tag):
    print tag
    return true

Any ideas how to actually test this extension function or debug it...?

As noted in those docs, .fullPath is not a string. Wrap it with str() to have string methods available. For providers, you would want to use .startswith() for maximum efficiency.

Or even tag.fullPath.source to extract just the provider, I believe. Null if the path doesn't specify it for some reason.


Indeed. Likely fastest, too.

Thanks guys, this worked:

def filterTag(self, tag):
	showProviders = ["G1Common", "G1LogPP"]

	if str(tag.fullPath.source) in showProviders:
		return True
		return False
	# end if

to filter out the realtime tags and folder nodes beneath the tag provider node.
Ideally i'd like to hide the root container node too.


I was under the impression a tag name of a folder node should be able to achieve this, but a quick test with the following didn't seem to hide any folders:

Which is why the lack of "print" command working is getting frustrating.

Use a logger.

Logger was also being intermittently strange, not working when browsing through the tree.
Seems like restarting designer when this happens does the trick, and re-opening the Window..

Clicking on a path of the Tag Browse Tree doesn't seem to refresh the tagFilter script.
Clicking the node "handle" seems to sometimes refresh the tagFilter script.
Very inconsistent.

Based on the output of the logger on initial load though, which is the same output if you manually force a refresh of the component, it seems there are two problems:

  1. it seems that the filterTag function doesn't return anything for root folder nodes... ie: [default], [G1Line01] etc.. Which are the things i want to filter on...
  2. It doesn't even show all applicable subnodes. the things shown in the logger below show subfolders of only 3 tag providers. But not the other two.?!?!

I know you can use the "rootNodePath" property, but that doesn't allow us to filter on multiple root nodes, and return more than one. Which is what i am trying to do.