Get Tag Paths for Tags with History

I'm wondering if there's a way to use syste.tag.browse() to find the paths to all of the tags that have history configured, or find the paths to all of the tags that have a specific parameter called out.

Not seeing anything in the filter key table that seems particularly helpful, but maybe something [else] would work that I'm not thinking of?

TIA

I can see the tag attributes if I just use browse with the script console:

'attributes':[history]

But I don't know how to check non-null (or a set) here

Maybe a combination of system.tag.browseHistoricalTags() and syste.tag.browse()?

I think this is a good case to use the Tag Report Tool, but it seems like there are also some scripting options given in this forum post

1 Like

Eventually will try and use this list with system.tag.configure() so it would be much more useful to have the list in a script than using the Tag Report tool.

The tag report tool has a scripting equivalent. The gui tool will even write a script for you with the filters chosen.

Well isn't that neat.

How would I go about excluding tags that are inherited from the parent UDT?

It would be quite cool if someone built a Perspective component to replicate the tag report tool :wink:

@amarks just uncheck "Include UDT Members" under the Configure Tag Report left pane.

2 Likes

But I do want to include UDT members. Just no the inherited ones.

For instance:

UDT 1 has a member "output" that has history.
UDT 2 's parent type is UDT 1, so output is included and has history, but it shouldn't be included in the list because UDT 1 is included.

I'd post-process the results, looking at the typeId's returned.

If for some reason tag report tool doesn't do exactly what you're needing, the only other way I have found to do this is to use a combination of system.tag.browse() and system.tag.read*(). You can specify the attribute that you are looking for in the path. so something like

tagPath = result.tagPath + ".history"

would do the trick. This way you can get results for tags that do not have history enabled, since the other options only return non-default values.

Seems like I can't get to the parameter at the UDT definition level using `system.tag.browse()`

I can get it if I do it like so:

path = '[default]_types_/UDTs/ScaleSignal_2SPFailAlm/Parameters'

#system.tag.browse(path)
system.tag.browse(path, {'name':'*Storage_Provider*'})

However, the filter doesn't seem to have any effect on the results and all parameters are returned.

But this requires the full path directly to the parameters and the path doesn't support wildcards, so doesn't really help.