Line return, with STRING variable

Hi,
Is it possible to return to the line in a STRING or WSTRING type variable, in structured text. I tried a lot of things: \n, $n, |, etc… Nothing seems to work

Hi,

I’m not sure if I got your question right: do you want to insert a line feed and/or carriage return into a string variable?
If yes: this is possible, for example in STRING datatype $r is CR and $n is LF.
More information about STRING literals can be found here:
https://help.br-automation.com/#/en/4/programming%2Fprograms%2Fprogrammingmodel_programs_literalsiniec.html

My question is, where should this content be displayed? Because for example in the watch window you won’t get a line feed / carriage return displayed.
The literals above would work if you store the string data in a file and open the file in a editor, or if you send it for example via a serial or tcp connection to a terminal program.
If you want to display it in a visualisation, I think then it won’t work (as I remember VC4 has a c based syntax for multiline, in mappView as I know it won’t work because of the HTML interpretation, there you could try to insert the HTML tag for line brake < br > into the string, but I’m not sure if that will work).

Best regards!

2 Likes

Hi, !
Yes it is to display it in an HMI screen. I tried $n and $r but it didn’t work. So this must not be possible. Thank you for your reply. :slight_smile:

It depends on your HMI if the line feed is actually wrapping the text. Inserting $r$n in Structured Text results in a CRLF. Same thing would obv. be \r\n in ANSIC.

In many HMI systems output fields have a property for wrapping. For a mappView label see e.g. Label [property: multiLine]

Best regards,

1 Like

Hi , what is the status of your topic? if is it solved, can you marked answer that helps you the most?