I have a python script where I am building a string one line at a time. I add the '\r\n' at the end of each line of a string with exception of the last line. This string gets written into a tag in Ignition SCADA. When I examine the contents of the tag, where the '\r\n' should have created the carriage return/new line all I have is a space (' ').
Any idea why this is behaving this way and what I can do to get the string to format correctly?
Thanks!
Edit: Here's the code:
myStr = ''
for i in range(1, 10):
myStr += 'This is line ' + str(i) + '.\r\n'
resp = system.tag.write('myStrTag', myStr)
print myStr
Ignition is sanitizing the input for those string tags. You can't have multi-line strings but it "knows" you wanted to include that. So it's translating your input to a white space character rather than leaving it as the literal "\r\n". If you wanted to have that you could include two backslash characters.
If you want the string to actually show up on screens as multiple lines you need to format it as an HTML string. That is the method that Ignition uses for storing and displaying strings with additional formatting. It actually works pretty well and can understand most HTML and CSS attributes. An example provided below.