I am using OPC-UA communication and i have string tag (Name of recipe). OPC Value shows "LocalizedText{text=CSX22, locale=null}" while i just need recipe name "CSX22".
How can I get this fixed?
It's not a String datatype, it's an OPC UA LocalizedText type, which isn't something Ignition has a corresponding tag type or mapping for right now
That's the Ignition Datatype it got set to, any unrecognized type gets set to a String and then its value becomes whatever the Java Object::toString
representation is.
Its OPC UA datatype is LocalizedText.
If you can't change the datatype in the server then the only workaround I can think of for now is an expression tag or script that tries to extract the portion after text=
and before , locale=
.
The value isn't exactly JSON, it includes the LocalizedText
bit at the front that would need to be chopped off.
A couple of different expressions Both work, but both are also a bit of a kludge.:
jsonGet(jsonFormat(right({value},len({value})-13)), 'text')
split({value}, '=|,')[1,0]
it seems this trick works. however I need to check it with other recipes (Values)
Thank you
I will say that if you have a lot of tags like this, it may be more efficient to roll this in to a UDT.