new line in string
Hi Team,
I have a text in the eHMI and would like to fill it with data from the PLC. Every event will be on a seperate line.
Is there a way of adding a New Line (like \n, 16#0A etc) into the string that is converted to a new line character in the eHMI?
Thanks in advance,
Carel
I have a text in the eHMI and would like to fill it with data from the PLC. Every event will be on a seperate line.
Is there a way of adding a New Line (like \n, 16#0A etc) into the string that is converted to a new line character in the eHMI?
Thanks in advance,
Carel
Comments
You can use the formatting option in the TO_STRING function to generate CR+LF characters, which you can concatenate to a STRING, something like in this answer:
https://www.plcnext-community.net/en/discussions/how-to-insert-cr-lf-into-string.html
That was it, thanks!
Carel
Hello Martin,
I tried this solution with CR LF, and it shows the string with a new line, but then in the HMI I still have only one line.
I tried as well the solution proposed in the other post but nothing, same problem, in the HMI i still have only one line
As last I tried the simpe escape character \n or N but still the same as well.
I'm using the latest PLCnext engineering 2023.0.1.
Do you have any idea why in the HMI i'll always get only one line and cannot split or create a new line?
Thanks in advance
Marco
I'm using PLCnext Engineer 2023.0.
I created a new project for AXC F 1152 version 2022.0.
In the Main program, I created a STRING variable with the HMI attribute checked:
I set the STRING variable to a string with a line break:
I created a new HMI page and set it as the Startup page.
I added a Text box to the page, then added a Text dynamic to the object that is connected to the STRING variable in the instance of the Main program.
When I send the project to the target and open the HMI page, the string is displayed with the line break:
I hope this helps you to identify what you're doing differently.
Found the bug, thanks Martin!