It is currently Mon Sep 01, 2014 3:13 am




Post new topic Reply to topic  [ 5 posts ] 
 TagName in UDT 
Author Message
Trooper
Trooper

Joined: Thu Nov 24, 2011 1:41 am
Posts: 18
Post 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...


Wed Jun 20, 2012 9:49 am
Profile
General
General

Joined: Wed Aug 08, 2007 5:05 am
Posts: 225
Post Re: TagName in UDT
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.


Wed Jun 20, 2012 10:31 am
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 3:43 pm
Posts: 2495
Post Re: TagName in UDT
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:
Code:
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.

Regards,

_________________
Colby Clegg
Inductive Automation
Software Development


Wed Jun 20, 2012 10:36 am
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 3:43 pm
Posts: 2495
Post Re: TagName in UDT
Quote:
One thing about UDT parameters, they are not accessible outside the UDT

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:
Code:
"{MyStrParam}"


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

Regards,

_________________
Colby Clegg
Inductive Automation
Software Development


Wed Jun 20, 2012 10:42 am
Profile
Trooper
Trooper

Joined: Thu Nov 24, 2011 1:41 am
Posts: 18
Post Re: TagName in UDT
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 :)


Wed Jun 20, 2012 10:46 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: