System.tag.browse result['fullPath']) is not returning the correct full path

The code looks like this:


path1 = '[IGN01_default]NL Sep 1/PTXX/'
results = system.tag.browse(path1,{"recursive":True, 'tagType':'AtomicTag'}).results

for result in results:
	tag_path1 = str(result['fullPath'])
	print tag_path1

is printing '[IGN01_default]NL Sep 1/PTXX/oEU'

instead of '[IGN01_default]NL Sep 1/PTXX/PT01/oEU'

I'm trying to write a script to count the number of tag in the historian.

Please edit your post (using the pencil icon), select the code block and press the </> code formatting button to preserve indents and apply syntax highlighting.
For inline code enclose it in a pair of backticks `` so that you get [IGN01_default]NL Sep 1/PTXX/oEU.

1 Like

I ran your code on my test system:

results = system.tag.browse(path1,{'tagType':'AtomicTag', "recursive":True}).results

for result in results:
	tag_path1 = str(result['fullPath'])
	print tag_path1

...and it works as expected, so I'm not sure what the issue is.

Perhaps you should try using system.tag,browseHistoricalTags instead.

The documentation shows a getReturnedSize() method that could be shortcut for what you are trying to do. The docs also provide a recursive function example that could be helpful for your usage case.