Adding control characters

Can I add control characters (such as CR or LF) to a string read from a table and send it out to an OPC tag? I have concatenated strings in the past, but I’m not seeing any way to add control characters.

Currently, I’m massaging the string to add them inside the PLC, so the application is working, but wanted to clean up PLC code and make it a little more transparent.



One solution is to create an action item, configure it to use a SQL query and enter an expression similar to the following:

SELECT string_column + CHAR(13) + CHAR(10)

Not to confuse the issue more but if you have the string in an OPC item and wanted to append control characters, you can use an expression like this:

Concat({opc_string_tag}, ToChar(13), ToChar(10))

Nope, not confusing at all.

Just so happens that a patricualr item from the table is selected in the PLC and then sent back. :imp: Anyway, the upshot is that it ended up less code to massage it in the PLC.

While my post ended up rather moot, I’ll definitely file this one away for reference. Thanks, MickeyBob!

Best regards to all,