Is there a way to sort with system.tag.browse?

Is there a built in way to have the system.tag.browse function sort by tag path, like there was with system.tag.browseTags?

I’m on 8.0.6

I don’t see any sort options on system.tag.browse, however the natural results have always been sorted by ascending fullPath when I’ve used it. For example. this recursive browse lists all opc and memory tags in ascending order:

def browseForTags(path, valueSources):
	'''Return tag paths of the specified valueSource type(s).'''
	
	# Call the browse function.
	results = system.tag.browse(path, {})
	 
	# Loop through every item in the results.
	for result in results.getResults():
		# If result has children, call the function to repeat the process, starting at the child.
		if result['hasChildren']:
			browseForTags(result['fullPath'], valueSources)
		elif result['valueSource'] in valueSources:
			tags.append(result)
         
# Create an empty list to be filled with tag paths.
tags = []
# Set parameters & call function.
path = '[default]' # Replace with root path of UDT/folder to browse.
valueSources = ['opc', 'memory']
browseForTags(path, valueSources)
# Print results.
for tag in tags:
	print tag
2 Likes