Get Tag Path From Tag Instance in Script

I’m trying to build a pen tag path in script to pass it to a new window with an Easy Chart on it. I can do this from within a template where the tag is a UDT tag. From this I can get the tag path from the UDT “Meta.TagPath” property and use it to substitute the tag provider with the tag history provider. This provides a string that can be passed to the easy chart tag pens dataset.

I want to do this for a single atomic tag as well but I cannot find any access to the tag path in properties or in script. There is nothing like the “Meta.TagPath” for an atomic tag and I cannot find any other way to do this dynamically (without knowing the name and tag path of the tag) in script.

Any suggestions would be appreciated.

Correct. Arrange to know the tag path as a string. Do not use UDT properties in User Interfaces--they lead to the trap you are in.

If your outer window was based on a tag path property combined with indirect tag bindings, you'd be done.

1 Like

I know what you are saying - I’ve heard you (and others) say this before. The problem is that the template needs a number of tags that just make it easier to do with a UDT tag. The UDT is not large, but it is all-encompassing for the template. And the template using the UDT works fine. The template with the atomic tag only uses one custom property for the tag, but now I have to add another custom property (besides the tag itself) in order to have the path? If I can right click on the tag and copy the tag path, why is it not available in scripting?

I keep hearing IA personnel say not to use UDTs, but then why are they part of the system? Of course the UDT works fine so this is really not part of this discussion in my opinion.

Pass the path to the UDT to the template. Then build off this for the tags under the UDT.

2 Likes

Use UDTs in the tag system to make tag creation/maintenance easy and error-free. Do not use UDT properties in your UI.

They (UDT props) exist because they were thought to be a good idea when created. Haven't turned out that way.

2 Likes

I honestly just wish they’d remove the option to define a custom prop with a UDT type (or at least disable the option in gateway config). I’m not aware of a use case where the UDT prop provides any benefit over using a path to the UDT instance instead.

In any case, @tbennett.tdc as the others have already stated DO NOT use UDT props as parameters. The parameter should be the string path to the UDT instance. Then define internal props for each tag you need and indirectly bind to those internal props and bind anything in your UI to those internal props.

It would break many legacy users.

Just leave it alone where you can, convert when you need to.

This seems like a major version tweak they could introduce.

First step would be to alter Vision template infrastructure to support tag path based drag-n-drop in place of UDT props.

1 Like