Get a flat list of all tags paths on the gateway?

Recursive browsing to get a list of all the tags is really slow because for each new folder/level the client has to send a new request to the server. I have had my recursive tag browse method tag actual minutes to complete.

Is there any way to get a flat list of tag paths from the gateway?

Here is my Browse method for reference

def browseTags(path, filt):
		results = system.tag.browse(path, filt)
		returnResult = []
		for result in results.getResults():
			# If the item has children, call the function to repeat the process but starting at the child.
			if result['hasChildren'] == True:
					returnResult.extend(browseTags(result['fullPath'], filt))
					print("Failed on Path: " + result['fullPath'])
				print("Tag Found: "+ str(result))
			print("Failed on Path: " + path)
			print("Result: " + str(results))	
	return returnResult

As of 8.1.2 you can pass a recursive: True parameter in your system.tag.browse call to have the recursion happen on the gateway automatically.

1 Like

Don’t do it! It’ll eventually grow to take longer than the client comms timeout. Use message handlers in both directions. Cache results in a project script on the gateway (and client, too, maybe).

1 Like