# OPC String tag value

**URL:** <https://forum.inductiveautomation.com/t/opc-string-tag-value/74124>\
**Category:** Ignition\
**Created:** [May 24, 2023, 1:39pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124 "2023-05-24T13:39:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amir\_Farmanbar](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Amir\_Farmanbar](https://forum.inductiveautomation.com/u/Amir_Farmanbar)\
**Post date:** [May 24, 2023, 1:39pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124/1 "2023-05-24T13:39:31Z")

</div>

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?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f62c6b9a5c5c36a30b38c0ffca62470b3ada0d0d.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 24, 2023, 1:49pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124/2 "2023-05-24T13:49:17Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![Amir\_Farmanbar](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Amir\_Farmanbar](https://forum.inductiveautomation.com/u/Amir_Farmanbar)\
**Post date:** [May 24, 2023, 4:06pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124/3 "2023-05-24T16:06:23Z")

</div>

properties shows data type: string

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/f/2fa185d252dcbe40aca4634db9103455381e0e2b.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 24, 2023, 4:08pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124/4 "2023-05-24T16:08:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 24, 2023, 4:10pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124/5 "2023-05-24T16:10:31Z")

</div>

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=`.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 24, 2023, 4:30pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124/6 "2023-05-24T16:30:32Z")

</div>

> [@Amir\_Farmanbar](#):
>
> LocalizedText{text=CSX22, locale=null}

Would this work for you?

 ![JSON get text](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/0/d0be2ad47389fb0dcd948d535443e9e1488c0235.png)

Expression: `jsonGet(jsonFormat({value}), "text")`

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 24, 2023, 4:32pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124/7 "2023-05-24T16:32:15Z")

</div>

The value isn't exactly JSON, it includes the `LocalizedText` bit at the front that would need to be chopped off.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [May 24, 2023, 5:06pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124/8 "2023-05-24T17:06:52Z")

</div>

> [@Amir\_Farmanbar](#):
>
> LocalizedText{text=CSX22, locale=null}

A couple of different expressions Both work, but both are also a bit of a kludge.:

```auto
jsonGet(jsonFormat(right({value},len({value})-13)), 'text')
split({value}, '=|,')[1,0]

```

---

<div class="post-metadata">

**Author:** ![Amir\_Farmanbar](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Amir\_Farmanbar](https://forum.inductiveautomation.com/u/Amir_Farmanbar)\
**Post date:** [May 24, 2023, 5:56pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124/9 "2023-05-24T17:56:03Z")

</div>

it seems this trick works. however I need to check it with other recipes (Values)

Thank you

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [May 24, 2023, 5:57pm UTC](https://forum.inductiveautomation.com/t/opc-string-tag-value/74124/10 "2023-05-24T17:57:55Z")

</div>

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.
