Generic OPC Display 800xA System
I am doing Generic OPC Communication and evelop the graphics faceplate.
I want this that i get one string from OPC and then i show in 800xA using the Input field in PG2 Graphics. But i want that if the Length of the string is more then 20 character then it goest down to next line not in strigth line. we can do it with expression builder but i don't know how to wirte the code for it.
Note: i don't have any issue in communication with thrid party plc,generic opc i just want to shift the string to next line.
If you have any query in my question then please let me know.
Voted best answer
The "\n" character is used to insert a line break at your will; if you don't want to break it, then you would have to do nothing more than the "TextMode" thing.
For example, if you want to write the following text:
The pressure of the SAT1 valve is too high.
Please open the valve manually.
Waiting for acknowledge...
Then you would have to put this code on the "Text" property of your input field (in the PG2 Graphics Editor in 800xA):
$'NewObject/string1.Value' +"\n" + $'NewObject/string2.Value' + "\n" + $'NewObject/string3.Value'
In this example, you have to declare an object (here creatively named "NewObject") and three String variables, one for each independent line of text. Therefore, in your PLC program, you should assign these values:
String1 := "The pressure of the SAT1 valve is too high."
String2 := "Please open the valve manually."
String3 := "Waiting for acknowledge..."
Remember to use the + (concatenation) symbol to join the strings, and the "" to surround the \n character, or else it won't be recognized.
I still haven't found a way to insert line breaks inside a single string, but usually there are methods to break a single string into multiple strings, depending of your PLC programming software.
On the Input Field Properties (right click->Properties), change the value of "TextMode" to TRUE. This property specifies if the text should continue in another line when it exceeds the width of the field. Please take into account that this function uses blank spaces to decide where to jump to the next line, which means that if your Input Field can show 20 characters, and you have an uninterrupted word of more than 20 characters without a space, it will appear incomplete even with TextMode active.
If you need to insert line jumps even when the field lenght is not exceeded (for example, in paragraphs), you need to insert \n in your string (e.g. "Text\nMode" would become Text