Parameter binding with replace

I am using ignition to connect to a Kepware OPC server that have an "ISA95" model plant.


The OPC tag path uses '.' for every hierarchy level

The tag browser from Ignition follows the same hierarchy and I would like to use the parameter PathToTag to bind the OPC Item Path value. However, the parameter uses '' in the hierarchy levels.
Is there any way i can replace the '' with '.'
nsu=KEPServerEX;s=WinCC.PHARMAPCS7OS.{{PathToTag}.replace('\\', '.')}/{TagName}/I.{ProcessUnit}/{TagNamePLC}/I_PV_Out#Value

Thank you!

I am not following the question, but it sounds like you want to get the OPC item path for a tag given the Ignition tag path?

You can get it via an indirect tag binding {1}.OpcItemPath (that may not be syntactically correct).
Just drag/drop the OpcItemPath for a tag onto a binding and the open up the binding properties and change it to indirect.

1 Like

Did you ever find a solution to this? In the exact same boat, Ignition tag paths use "/" as a separator, and OPC server uses "." As a result, even with identical structures in both systems, {PathtoParentFolder} as a parameter binding for an OPCItemPath in a UDT definition does not work. You can pass parameters to number formatting, but I can't find a way to pass the string to replace or regex to format it properly. Seems like it should be so simple, but the options for parameter manipulation are very limited in this specific location.

Any answers?

As much of a developmental aid it would be, I fear actually being able to do something like this would put unnecessary load on the gateway.

That said, you could do this using a script to write to the opcitempath. You can't use the expression language within one of these tag prop bindings.

This is an anti-pattern. PLC data structures are usually not the structures you need in Ignition to maximize template/view re-usability. Organize your Ignition tag folders and UDT instances to facilitate efficient and intuitive User Interfaces, not to match the PLC's data hierarchy. The whole point of having an unrestricted OPC Item Path is to allow the two hierarchies to be distinct.

Oh, I get that. But in this case it is not a PLC, it is an already abstracted OPC server that has a model and hierarchy that works very (very) well for data visualization and UI. So copying that structure into Ignition makes sense. And if I could get this little piece to work then I create a UDT, name the tags within to match the names in the OPC server, and everything else just falls into place automatically (except for the pesky difference in separators).

[Edit]
FWIW I managed one way to do this this morning. Created a "DeviceBase" UDT that has one expression tag and one parameter "PathString". The expression tag passes the {PathtoParentFolder} to a runScript that does a replace and writes the string back out to the parameter using system.tag.configure. Use that UDT as the parent type for each device UDT, and then OPCItemPath becomes {PathString}.{TagName}.

What I have not done yet is evaluate the load of doing it this way, that's next on the list, but it works.