Component Name Invalid

I am setting up a new project extensively using templates and UDTs. As I place template instances on a window, I name them by binding their “Name” property to a tag that contains the name for this instance.

example: pump UDT contains 2 tags: running (opc-bool) and name (memory-string). I create a tag from this data type called pump1 and assign the name pump1 to the underlying name tag. I create a template of a pump that displays the running status and the pump name. When I place an instance of this template on a window and set up the paths it all works fine. As a last step I name this template instance by binding its “Name” property to pump1/name. (this is what causes the problem.)

All is good until I start up a client. The first time this window is displayed, it throws the following error:


After I clear the error, all is good until I start the client again, when the same thing happens. Why is this error occuring and if I can’t stop it, what can I do to keep it from displaying?

You are getting the error because right before the value that is passed in updates the binding returns a -1 value. You would have to catch that value and return something else since the name cannot have a - sign. It really isn’t recommended to bind the name property.

I really like the organization that linked names brings so I am not ready to give that up yet. Could you help me with the code to catch the error?

Here is the code I use to strip '-'s from tag names. This goes in the Name binding as an expression.

replace({Root Container.Path To.Component Name.Bound Tag},'-','')

Robert,
The replace function works like a charm. Thank you.