How to check History Enabled or not for tags using system.tag.browse?

Hi I tired this

rootNodePath = 'test/path'
filterDict= {"tagType":"AtomicTag","recursive":True}

for result in system.tag.browse(rootNodePath, filterDict):
	print result

It doesn't showing History enabled or not for a tag

how to get that?

Doesn't system.tag.browseHistoricalTags() cover your needs?
https://docs.inductiveautomation.com/display/DOC81/system.tag.browseHistoricalTags

Hi noo its not returning history enabled or not

system.tag.browse() returns a list of nodes at the given path.
system.tag.browseHistoricalTags() will return only historical tags found at a given path (that means that history is enabled on all of them)

When you want to read a specific property, just use system.tag.readBlocking() with the property appended to the end of the tag paths.

system.tag.readBlocking(['test/path.historyEnabled'])[0].value

Of course you can combine this with system.tag.browse()

rootNodePath = 'test/path'
filterDict = {'tagType':'AtomicTag','recursive':True}
for tag in [system.tag.readBlocking([str(result['fullPath']) + '.historyEnabled' for result in system.tag.browse(rootNodePath, filterDict).getResults()]):
    print tag.value
1 Like

Thanks this is the line exactly i am looking
for tag in [system.tag.readBlocking([str(result['fullPath']) + '.historyEnabled' for result in system.tag.browse(rootNodePath, filterDict).getResults()]):

It works very fast compare to system.tag.readBlocking(['test/path.historyEnabled'])[0].value this one

One doubt i want to get the full tag path which are not history enabled

for tag in [system.tag.readBlocking([str(result['fullPath']) + '.historyEnabled' for result in system.tag.browse(rootNodePath, filterDict).getResults()])
     print result(['fullPath'])

But its not returning right tag path

something to change in script?

In the script you provided, the line print result(['fullPath']) is not valid.

You would need to do something like this instead:

rootNodePath = 'test/path'
filterDict = {'tagType':'AtomicTag','recursive':True}

paths = [str(result['fullPath']) for result in system.tag.browse(rootNodePath,filterDict).getResults()]
qVs = system.tag.readBlocking([path + '.historyEnabled' for path in paths])

for path,qv in zip(paths,values):
    if qv.value:
        print path
1 Like