TagName in UDT

Is that possible to use the TagName property inside a UDT ?
I have a Tag on wich I have a alarm.
I want to make the alarm name using the name of the instances of the UDT.
I tried things like “Alarm {[.]Meta.TagName}” but it doesn’t work.
If someone have an idea…

I don’t think it’s possible to access tag properties within a UDT. Try creating a string parameter in the UDT and you can reference that in the other tag members of the UDT.

What I ended up doing is creating a UDT called Common_UDT and added parameters Name, ShortName, TagPath, OPCPath and used this Common_UDT as the Parent for all my UDTs. All my UDTs require those parameters so using Common_UDT as a parent for all my other UDTs prevented me from having to add the same parameters over and over. Then there’s the added benefit of if I have an additional parameter I need to add to all my UDTs I only have to add it to Common_UDT and then it becomes available to all my UDTs.

One thing about UDT parameters, they are not accessible outside the UDT. This was a bummer because in the application I need to reference those parameter values, so what I did was create Memory SQLTags (Name, ShortName, TagPath, OPCPath) in Common_UDT and then set their values to the parameters. This only works for String values though.

NOTE: I wrote this at the same time as Pat wrote his post. His idea is similar and probably better.

Unfortunately, you won’t be able to have an automatic/dynamic link right now. Instead, the best you can do would be to create a parameter on the UDT for “InstanceName”, and then set it for each instance you make. In other words, you’ll have to manually make sure it is the same as the tag name. Then, in your alert settings, you can reference that parameter, like:

Alarm {InstanceName}

The main problem is that the alarm name does not allow bindings, and unfortunately there aren’t any “meta” properties available in UDT parameters (that is, we could possibly make a set of parameters that were available all the time, like Instance Name, Tag Path, etc).

In 7.6, which is 100% focused on Alarming, more fields will be bindable.


Yeah, we've gotten a lot of feedback about this. This is something we had to do for time constraints, and which I hope we can fix soon.

The memory tag work around is good. The fact that it is "string only" is just an unfortunate side effect of the value editor. If you need non-string tags like this, you can create an expression tag, and have its expression be a reference to the parameter (you don't get the handy popup menu, but it will work with the standard "{param}" syntax). However, there is a trick: you need to imagine what it's doing behind the scenes: swapping the param value before then compiling it as an expression. So, you have to make sure it's a valid expression after the swap. For numbers, this is easy. For strings though, you have to do something a little unintuitive and wrap it in quotes, like:


Anyhow, hopefully we'll eliminate the need for these workarounds soon.


Thanks for your answer.
I just wanted not to add a property I’ll have to manually set for each instance…
Never mind, maybe in 7.6 so :slight_smile:

InstanceName and TagName are now built-in UDT Parameters in 7.7.