# Vision Client Tag Project Inheritance

**URL:** <https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737>\
**Category:** Ignition\
**Tags:** vision, ignition81\
**Created:** [May 22, 2024, 1:46pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737 "2024-05-22T13:46:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 22, 2024, 1:46pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737/1 "2024-05-22T13:46:16Z")

</div>

I know this has been talked about before. When a new project is created as a child of an inheritable project it gets a copy of the vision client tags, so they're not _really_ inherited, meaning that adding a client tag to the parent project doesn't add it to the child project.

Has anyone found a workaround for getting these client tags to update somewhat automatically, instead of just duplicating the new tags in the child project?

I probably just need to script the creation of these tags with default values if they don't already exist at the parent project level.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 28, 2024, 3:31pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737/2 "2024-05-28T15:31:37Z")

</div>

You could script up something that runs in the designer and duplicates the (new) parent resource definition, semi-automatically. I wouldn't really know where to begin on authoring a _merge_ tool, via scripting. You're dealing with the neglected orphan of the tag system, in this area - it's both the legacy tag definitions and classes, _plus_ it's the weird one-off client-scoped implementation of them. None of the modern tag editing SDK classes or scripting methods you're used to will be available to help.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 28, 2024, 3:47pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737/3 "2024-05-28T15:47:41Z")

</div>

I think it would be acceptable to have a designer scoped semi-automatic client tag update script. I'll have to work on that. Maybe some sort of client startup script to check that the vision client tags exist

Thanks

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 28, 2024, 3:53pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737/4 "2024-05-28T15:53:02Z")

</div>

Here's some different topics to explore as a starting point of the project system:

> [@Display all scripting code of window and template components](https://forum.inductiveautomation.com/t/display-all-scripting-code-of-window-and-template-components/20262/4):
>
> Most of the code should still be valid, you'll just have to extract the resources from the project differently. Some reference points to start from:

You're looking to remove the singleton instance of the `ResourceType("com.inductiveautomation.vision", "client-tags")`, then fetch it from the 'effective' resource configuration (which will give you the parent project's copy, if it exists), then write that copy back to the project.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 28, 2024, 4:45pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737/5 "2024-05-28T16:45:43Z")

</div>

I was thinking something along the lines of having a preset list (folder) of (unused) gateway tags that get made into client tags at client startup, if they don't exist, with the gateway tag values being the default values.

Something like:

```python
def createVisionClientTags():
	defaultTags = system.tag.browse('Vision_Client_Defaults', {'recursive':True, 'tagType':'AtomicTag'})
	
	for tag in defaultTags:
		defaultPath = str(tag['fullPath'])
		clientPath = '[client]' + defaultPath.split('Vision_Client_Defaults/',1)[1]
	
		if not system.tag.exists(clientPath):
			defaultConfig = system.tag.getConfiguration(defaultPath, False)[0]
		
			clientTagBasePath = clientPath.rsplit('/',1)[0]
	
			#create client tag

```

Just not sure how to create the client tag

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [June 6, 2024, 1:48pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737/6 "2024-06-06T13:48:29Z")

</div>

Any insight on how to create the client tags?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 6, 2024, 4:51pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737/7 "2024-06-06T16:51:06Z")

</div>

I don't think it's possible, if I remember the research I did in this thread correctly:

> [@\[bug-16241\]Ignition 8 - system.tag.importTags to create vision client tags?](https://forum.inductiveautomation.com/t/bug-16241-ignition-8-system-tag-importtags-to-create-vision-client-tags/33405):
>
> Can we use this function system.tag.importTags to create vision client tags ? collisionPolicy = "a" filePath = "d:/test.xml" basePath = "[client]" system.tag.importTags(filePath, basePath, collisionPolicy) return java.lang.NullPointerException (Ignition 8.0.10) Is there any way to create a cision client tag by scripting in Ignition 8 ? system.tag.configure only support gateway tags but not vision clients tag ?

That's why I suggested going down the resource specific route.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [June 6, 2024, 6:16pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737/8 "2024-06-06T18:16:36Z")

</div>

Ok, but I don't really know where to start with this info.

> [@paul-griffith](#):
>
> You're looking to remove the singleton instance of the `ResourceType("com.inductiveautomation.vision", "client-tags")`, then fetch it from the 'effective' resource configuration (which will give you the parent project's copy, if it exists), then write that copy back to the project.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 6, 2024, 7:16pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737/9 "2024-06-06T19:16:03Z")

</div>

> [@Auto-Export all Vision window Documentation](https://forum.inductiveautomation.com/t/auto-export-all-vision-window-documentation/72643/2):
>
> With [Ignition Extensions](https://forum.inductiveautomation.com/t/ignition-extensions-convenience-utilities-for-advanced-users/64615) installed, you could call system.project.getProject() to get an instance of the [Project](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.26/com/inductiveautomation/ignition/common/project/Project.html) Java class. From there, call getResourcesOfType with a resource type of com.inductiveautomation.factorypmi.common.VisionModule.WINDOW\_RESOURCE (this'll only work directly in the designer; doing it from the gateway scope will be a bit trickier). That will give you a list of ProjectResources, which have a [getDocumentation](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.26/com/inductiveautomation/ignition/common/project/resource/ProjectResource.html#getDocumentation()) method. Technically, Ignition Extensions is not required (you c…

So, in order, to do the semi-automatic "get the parent resource definition" I described above:

1. Create or obtain the ResourceType instance that matches the client tag project resource.
2. Obtain an instance of the local DesignableProject instance.
3. Ask the project to discardOverrides for the 'root' resource path of the resource type you care about (I forgot this method existed). So `myClientTagResourceTypeReference.rootPath()` to obtain the path, and `myDesignerProjectReference.discardOverrides(thatPath)`.
4. Reopen the project in the designer, and Vision should automatically recreate the client tags from the parent project.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [June 11, 2024, 6:53pm UTC](https://forum.inductiveautomation.com/t/vision-client-tag-project-inheritance/90737/10 "2024-06-11T18:53:25Z")

</div>

I suppose there's no way that `system.tag.copy` could work here?
