# String not showing correctly in PLC

**URL:** <https://forum.inductiveautomation.com/t/string-not-showing-correctly-in-plc/34134>\
**Category:** Ignition\
**Created:** [April 22, 2020, 7:10pm UTC](https://forum.inductiveautomation.com/t/string-not-showing-correctly-in-plc/34134 "2020-04-22T19:10:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![warren.johnson](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@warren.johnson](https://forum.inductiveautomation.com/u/warren.johnson)\
**Post date:** [April 22, 2020, 7:10pm UTC](https://forum.inductiveautomation.com/t/string-not-showing-correctly-in-plc/34134/1 "2020-04-22T19:10:44Z")

</div>

I have a set of memory tags(string) that I concate together to form string sent to the PLC. The format shows correctly except for the last memory tag which I have a value of :STAR $r$1, but shows in the PLC as :STAR $$r$$1. Is there some format that I have incorrectly. This is controllogix PLC.

---

<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:** [April 22, 2020, 7:49pm UTC](https://forum.inductiveautomation.com/t/string-not-showing-correctly-in-plc/34134/2 "2020-04-22T19:49:00Z")

</div>

**$** is what is known as an escape character in the Rockwell world. so It is literally trying to give you a dollar sign in your PLC string ($$ is for the dollar sign). You will need something similar from Igniiton.

There’s part of me that thinks that it should be $R$L as that is a standard carriage return / line feed sequence.

try placing it with **\r\n** in your Ignition string.

---

<div class="post-metadata">

**Author:** ![warren.johnson](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@warren.johnson](https://forum.inductiveautomation.com/u/warren.johnson)\
**Post date:** [April 22, 2020, 7:52pm UTC](https://forum.inductiveautomation.com/t/string-not-showing-correctly-in-plc/34134/3 "2020-04-22T19:52:37Z")

</div>

$R$L is correct. With \r\n, it gives me \r\n in the PLC.

---

<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:** [April 22, 2020, 8:03pm UTC](https://forum.inductiveautomation.com/t/string-not-showing-correctly-in-plc/34134/4 "2020-04-22T20:03:48Z")

</div>

Are these from expressions, then? You may have to script it together, as I don’t think there is any provision for control characters in expression language.

---

<div class="post-metadata">

**Author:** ![warren.johnson](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@warren.johnson](https://forum.inductiveautomation.com/u/warren.johnson)\
**Post date:** [April 22, 2020, 8:04pm UTC](https://forum.inductiveautomation.com/t/string-not-showing-correctly-in-plc/34134/5 "2020-04-22T20:04:17Z")

</div>

Yes, I am thinking that’s what I will have to do.

---

<div class="post-metadata">

**Author:** ![warren.johnson](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@warren.johnson](https://forum.inductiveautomation.com/u/warren.johnson)\
**Post date:** [April 23, 2020, 10:34am UTC](https://forum.inductiveautomation.com/t/string-not-showing-correctly-in-plc/34134/6 "2020-04-23T10:34:18Z")

</div>

The string is made of several strings put together based on settings. The last section of the string is always :STAR $r$l, so I just made that a constant value in the PLC and concate that in the PLC itself to the rest of the string that I was combining in Ignition. Just an extra step, but it works. This was originally all done in the PLC, but I am using the Recipe Module and wanted to take advantage of it versus keeping all the setpoints in the PLC. Thanks for the help.

---

<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:** [April 23, 2020, 11:56am UTC](https://forum.inductiveautomation.com/t/string-not-showing-correctly-in-plc/34134/7 "2020-04-23T11:56:15Z")

</div>

I was able to take a closer look this morning, and test it out on my bench, if you ever want to revisit it.

I could set up a script to add the CRLF and write it to a tag.

Project script:

```python
def addCRLF(stringIn):
	return str(stringIn) + '\r\n'

```

On a text field property change:  
Write to a tag

```python
if event.propertyName == 'text':
	output = hci.string.addCRLF(event.newValue)
	system.tag.writeBlocking(['[default]Test/Recipe/tagOut'],[output])

```

Write to opc

```python
if event.propertyName == 'text':
	output = hci.string.addCRLF(event.newValue)
	server = 'IgnitionOPCUA'
	path = '[Jordan CLogix]Program:StringTest.StringIn'
	system.opc.writeValue(server, path, output)

```

---

<div class="post-metadata">

**Author:** ![warren.johnson](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@warren.johnson](https://forum.inductiveautomation.com/u/warren.johnson)\
**Post date:** [April 23, 2020, 2:54pm UTC](https://forum.inductiveautomation.com/t/string-not-showing-correctly-in-plc/34134/8 "2020-04-23T14:54:41Z")

</div>

That looks great. I may have to try that after we get the initial testing done with the system. Thanks.
