Creating parameterized UDT from existing tag structure

Hi All,

I have an existing tag structure of about ~750 tags I want to create a UDT from, but I want the tag paths to be dynamic based on two parameters. I can easily do this through the GUI, but it will take me several hours to do it by hand.

Here’s what the tag looks like before changed:

      "valueSource": "opc",
      "opcItemPath": "ns\u003d1;s\u003d[Device1]Program:PRG1.ProductionDisplay.ActiveShiftNum",
      "dataType": "Int1",
      "historyProvider": "History",
      "name": "ActiveShiftNum",
      "historyEnabled": false,
      "tagType": "AtomicTag",
      "opcServer": "Ignition OPC UA Server"

I’m trying to parameterize the “Device1” and “PRG1” fields of the opcItemPath, which is easy enough, however adding a parameter binding also adds extra json code so it is not as simple as finding and replacing all Device 1 with my parameter binding, here’s what it looks like after:

      "opcItemPath": {
        "bindType": "parameter",
        "binding": "ns\u003d1;s\u003d[{device_name}]Program:{op_program_name}.ProductionDisplay.ActiveShiftNum"
      },
      "valueSource": "opc",
      "dataType": "Int1",
      "historyProvider": "History",
      "name": "ActiveShiftNum",
      "historyEnabled": false,
      "tagType": "AtomicTag",
      "opcServer": "Ignition OPC UA Server"

Does anyone know of a method of quickly editing all 750 tags to match this new structure? I’m using Ignition 8.1.0.

Note: The opcItemPath will be much different for each tag as some are in folders and some are in the root. I tried using regex in a text editor with wildcards but it was too complicated with all of the json indenting for each folder/directory.

Can’t you just find replace “device1” with your param, and do the same for your other params? From what you said last, you might have to do a few different find/replaces. Otherwise, what are some other examplea you have?

Ignition won’t automatically update the binding type to be parameter, even though the opc item path has a parameter in it. OP would need some way to add the parameter bind type text for each tag. You could find and replace

"opcItemPath":

with

"opcItemPath": {
        "bindType": "parameter",
        "binding":

and then find/replace

,"dataType":

with

},"dataType":

Not sure if this would work though.

1 Like

Good point, i’ve run into this before and used regex to fix them up which I forgot about.

FWIW, this is what I use:
For my tag addresses that are structured like this:
ns=1;s=[{PLCName}]{DeviceName}.rest_of_tag.address
In Notepad++, I use this to fix them up:
Find:
("opcItemPath": )("ns\\u003d1;s\\u003d\[{PLCName}]{DeviceName}.)([\w.]+")
Replace:
$1{"bindType": "parameter","binding": $2$3}

1 Like

Thank you, Thank you, Thank you. I had to modify the regex a bit to fit my tag structure, some of the tags ended in an array specifier like tag[7] so I just made group 3 of the regex a (.*"). This saved me hours of work, I appreciate it.

1 Like