getConfiguration From Gateway Tag and configure New Client Tag

I have a set of ("default") tags that exist within a tag provider that I want to make sure also exist in Vision's [Client] tag provider. I'm trying to achieve this using the following steps:

  1. Browse the "default" tags using system.tag.browse() recursively.
  2. Substitute [client] in the fullPath to get the equivalent vision client tag path.
  3. Use system.tag.exists() to see if the client tag exists.
  4. Use system.tag.getConfiguration() to get the default configuration.
  5. Use system.tag.configure() to set the new client tag's configuration from the default configuration.

I'm just having trouble with the last step.

#get default tags
defaultTags = system.tag.browse('Vision_Client_Defaults', {'recursive':True, 'tagType':'AtomicTag'})

for i, tag in enumerate(defaultTags):
	#default tag path
	defaultPath = str(tag['fullPath'])
	
	#client tag path
	clientPath = '[client]' + defaultPath.split('Vision_Client_Defaults/',1)[1]
	
	#check to see if client tag exists
	if not system.tag.exists(clientPath):
		#get the default tag configuration
		defaultConfig = system.tag.getConfiguration(defaultPath, False)[0]
		
		#get the client tag base path
		clientTagBasePath = clientPath.rsplit('/',1)[0]
	
		#create the client tag
		system.tag.configure(clientTagBasePath, defaultConfig)

I get a Provider not found: client error. I'm guessing it's a scope issue? (just testing, running from the script console).

The Vision Client Tags subsystem didn't get updated to the new tag model for v8.0. So system.tag.configure(), which is built to rely on the new system, chokes. Try with the deprecated functions from v7.9.

system.tag.addTag

Can't add client tags?

Hmm. You may have to directly access the client tag manager from the designer context. (That is, SDK methods. And therefore not possible in a supported way.)

"Can't do it" just seems like a lazy programmer excuse because I can't think of a logical reason why one specific type of tag couldn't be created via a script, called in the correct scope.

I have not done anything SDK. Where might I look?

Vision Client tags have always been special. Their definition is per project and their runtime instances have unique values per client. Nothing else in the tag system is like that.

That looks pretty foreign to me :sweat_smile:

If you have my Toolkit installed, then this:

mgr = system.util.toolkitCtx().tagManager

will give you the instance of that class in Designer and Vision Client contexts.

You may need to poke around with reflection to discover everything possible, and/or do so with the ClientTagProvider itself.

(I can't help that it is cryptic and undocumented, sorry.)