# Reading String Tag From ControlLogix PLC using CMT-G01 - MQTT connection

**URL:** <https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790>\
**Category:** Ignition\
**Created:** [December 6, 2023, 4:01pm UTC](https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790 "2023-12-06T16:01:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eagel007](https://avatars.discourse-cdn.com/v4/letter/e/7bcc69/32.png) [@Eagel007](https://forum.inductiveautomation.com/u/Eagel007)\
**Post date:** [December 6, 2023, 4:01pm UTC](https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790/1 "2023-12-06T16:01:32Z")

</div>

Hi there,

for ControlLogix PLC String tag, I am only able to capture LEN and DATA. where DATA is in SINT. In my case, I am trying to get String value scanned from barcode reader. However the only format I can get it is in SINT. I am guessing then I would need to convert each SINT to Chr( ) in Ignition and concatinate to get true string value.

Is this the only way?

Please Help!

Thanks

---

<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:** [December 6, 2023, 4:11pm UTC](https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790/2 "2023-12-06T16:11:19Z")

</div>

Where's this tag / tag(s) coming from?

Ignition's Logix drivers expose tags as a single String tag, not as its individual structure members.

---

<div class="post-metadata">

**Author:** ![Eagel007](https://avatars.discourse-cdn.com/v4/letter/e/7bcc69/32.png) [@Eagel007](https://forum.inductiveautomation.com/u/Eagel007)\
**Post date:** [December 6, 2023, 4:16pm UTC](https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790/3 "2023-12-06T16:16:32Z")

</div>

coming from ControlLogix 1756 - (CMT-G01 - MQTT Gateway) - Broker - Ignition.  
While loading on CMT-G01 , Its only able to read INT and SINT.

---

<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:** [December 6, 2023, 4:17pm UTC](https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790/4 "2023-12-06T16:17:28Z")

</div>

> [@Eagel007](#):
>
> While loading on CMT-G01 , Its only able to read INT and SINT.

Okay, well unless this thing can do a better job of modelling Strings, you have to live with the manual conversion of some sort.

---

<div class="post-metadata">

**Author:** ![Eagel007](https://avatars.discourse-cdn.com/v4/letter/e/7bcc69/32.png) [@Eagel007](https://forum.inductiveautomation.com/u/Eagel007)\
**Post date:** [December 6, 2023, 4:18pm UTC](https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790/5 "2023-12-06T16:18:08Z")

</div>

I see! so its the Gateway's capability then!

---

<div class="post-metadata">

**Author:** ![Eagel007](https://avatars.discourse-cdn.com/v4/letter/e/7bcc69/32.png) [@Eagel007](https://forum.inductiveautomation.com/u/Eagel007)\
**Post date:** [December 6, 2023, 7:00pm UTC](https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790/6 "2023-12-06T19:00:56Z")

</div>

any tips for manual conversion?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 6, 2023, 7:42pm UTC](https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790/7 "2023-12-06T19:42:43Z")

</div>

Consider configuring the CMT gateway to access the tag as a string, then publish that over MQTT. (Sadly, Maple Systems doesn't want people looking at their protocol documentation.)

---

<div class="post-metadata">

**Author:** ![Eagel007](https://avatars.discourse-cdn.com/v4/letter/e/7bcc69/32.png) [@Eagel007](https://forum.inductiveautomation.com/u/Eagel007)\
**Post date:** [December 6, 2023, 8:03pm UTC](https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790/8 "2023-12-06T20:03:33Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/b/1b9d52454109b434e3b74a787f2b800eca94cafc.png)

This is what I get. I cannot select String, it divides further into LEN and DATA. where DATA in SINT has individual characters and ignition also takes it same way. since thats how gateway is sending data.

---

<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:** [December 6, 2023, 8:22pm UTC](https://forum.inductiveautomation.com/t/reading-string-tag-from-controllogix-plc-using-cmt-g01-mqtt-connection/82790/10 "2023-12-06T20:22:50Z")

</div>

Here's a starter script:

```auto
def readString(lenTagPath, baseDataTagPath):
    length = system.tag.readBlocking([lenTagPath])[0].value

    dataTagPaths = [baseDataTagPath + "/" + str(i) for i in range(length)]
    dataTagValues = [qv.value for qv in system.tag.readBlocking(dataTagPaths)]

    value = ''.join([chr(v) for v in dataTagValues])

    print value

```

Given these tags:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/d/ed19c0aea612aa21c0eb5d7d75560bedb32e8920.png)

```auto
StringUtil.readString("Length", "Data")

```

```auto
hello
>>> 

```
