filterTag extention function

Hello everyone,
I was going through the user manual and other topics in the forum about the use of filterTag extension function under Tag Browse Tree.
But unfortunately, i didn’t find any helpful information relating to it.
It would be delightful to know how to use the filterTag extension function to make particular tag invisible in tag browse tree during runtime if all tag present in same tag provider.

Thanks

The tag object you get passed to you contains some information you may find useful to accomplish your task. Put this in your script to find out the methods and attributes available.

print dir(tag)
return true

You can definitely filter out any tag you want, but I’m not sure what you mean by “if all tag present in same tag provider”.

You can also find a number of discussions of this feature on these forums by searching for “filterTag”, like so:
http://forum.inductiveautomation.com/search?q=filterTag

Hi @pturmel,
I went through all the discussions relating to filterTag, I saw one of your suggestions too in Limit the information displayed when using the Tag Browse Tree.
You have suggested the implementation of the filterTag extension function.
But working example code for implementing it would be appreciated.

I have tried the code explained in other discussions relating to FilterTag function, But didn’t seem to workout.

I have tried using the code: if tag.name == "bay1status": return true if tag.name == "bay2status" return false

but, I get the above error. I want to use historical tag mode to display only historical tags.

Just asking,

But why not use the realtime tag mode and just check the box that says “Include Historical Tags” and uncheck the box that says “Include Realtime Tags”. This will provide to you only the historical tags with no scripting. :wink:

Hi @brandon1,
I am already using the historical tag mode, my query is how to make invisible some historical tags from historical tag browse tree as per the choice.

Understood.

In that case give this a try:

import com.inductiveautomation.ignition.common.sqltags.model.types.TagType
folderType = com.inductiveautomation.ignition.common.sqltags.model.types.TagType.Folder
if tag.getType() == folderType:
		return True
elif tag.name == "bay1status":
        return True
elif tag.name=="bay2status":
        return False
else:
        return True

@brandon1 I tried the code but, yet no success…:pensive:

I have only tried this code in the realtime tag mode. I’m not sure how it would work in the historical mode.
Try just printing out tag.name and always returning true to make sure tag.name returns what you think it should.