Imported Tag DataType OPC Item binding not being evaluated

This is a strange one… but an issue I’m seeing with 8.0.6.

If I import a datatype that has parameters, ie Device and BaseTag, and use those specifically in the OPC Item Path to develop the item path, those bindings aren’t being evaluated on those tags anymore.

In UDTs that were created/imported prior to 8.0.6, and possibly earlier, those OPC Item Paths are grey and in italics. However on newly imported tags they are black and regular text. Tags created from this new UDT don’t have their OPC Item patch replaced properly. The look like “[{Device}]{BaseTag}” in their OPC item path rather than “[PLC]test” or whatever the parameter is assigned on Device or BaseTag. If I go into the UDT and select “Edit…” on the OPC Item Path and just select “Commit” then the tag evaluations start to happen correctly.

So… it this a bug or is there another step I’m missing? Is there anyway to get around having to go through potentially hundreds of OPC Item Paths to get them working again?

I’m also running into this, except when assigning the OPC Item Path via system.tag.configure(). If I go through and “Browse OPC”, select the path, and then edit it with the parameters, it evaluates (goes italic). If I assign the exact same string via the configure function, it does not turn to grayed italics and does not evaluate.

If you’ve found a fix for this, I’d be grateful.

Edit: I’ve found a fix for this, apparently there is a bindType as well as a Binding argument for the opcItemPath. I’ve attached my script below that edits the bindType to parameter.

results = system.tag.browse(path = '[Fairfield Water Plant]Devices/Valves', filter = {'name':'*Filter*'})
for result in results.getResults():
    path = str(result['fullPath'])
    tagType = str(result['typeId'])
    
    if 'Discrete' in tagType:
    	pathToTag = path+'/Mapping/Sts'
    	tag = {
    		"name" : 'OpenSts',
            "opcItemPath" : {
              "bindType" : 'parameter',
              "binding" : 'ns=2;s=AB_FF_WP.AB_FF_WP.Filt{FolderName}_VALVES.VALVE{DeviceName}'
              }
       		}
       	system.tag.configure(pathToTag, [tag], 'm')

    
    if 'Analog' in tagType:
    	pathToTag = path+'/Mapping/Sts'
    	tag = {
    		"name" : 'Pos',
            "opcItemPath" : {
              "bindType" : 'parameter',
              "binding" : 'ns=2;s=AB_FF_WP.AB_FF_WP.Filt{FolderName}_VALVES.{DeviceName}'
              }
       		}
       	system.tag.configure(pathToTag, [tag], 'm')

Note: This edits the Analog and Discrete valves in a folder that contains ‘Filter’ in the name. You want to point the pathToTag to the parent folder and specify the tag name in the “name” argument. ‘binding’ should be whatever you want your binding to be.

1 Like

Has a fix been found for this? I am having an identical issue

Just wanted to bump this issue since it is still present. The issue for me showed when trying to create a UDT from an existing folder of tags. The parameters for the path of the tags are all bound to the new UDT parameters. The issue is that when you create them, the binding shows up as plain text so none of them work. After some comparison, I noticed that the ones that work are bindings, appear italicized, and have the blue binding link in the Tag Editor. Interestingly, I found that if I forced italicization (is that a word?) in a text editor and did a find and replace on some of the simpler bindings that corrects the issue but the more complicated ones are still an issue. This really complicates creating UDTs to the point of making it prohibitive in some cases. Are there other solutions available that I have not found yet?

Make sure your JSON exports that you are using show the nested JSON for the binding, not just a string with curly braces embedded.

1 Like

As far as I know, the issue appears to be related to HOW the import files are generated.

As @pturmel mentioned, export your tags to JSON an inspect a 'good config' against a 'non-working config'. For a good config, you should notice something resembling a dictionary for the value of the opcItemPath key within a tag:

"opcItemPath" : {
    "bindType" : 'parameter',
    "binding" : 'ns=2;s={param1}_{param2}'
}

Others have posted their solutions (scripts) to detect these and correct them.

A well-crafted regex search/replace could also be used.
For any of the methods, use at your own risk...

1 Like

Thank you gentlemen for the replies. Unfortunately I am trying to take folders of tags with individual bindings and use them to create UDTs with dynamic bindings. I will definitely look into the scripts commented here and see what I can come up with.

The key is that just putting curly braces into tag property settings in JSON is not sufficient to make a binding. Wherever you want to change a constant to a binding, convert to the syntax Chris shows above.

2 Likes