OMRON
Remarks
Argument
textpoint
formattext
expression
Typical Examples
TextPoint = FormatText ("Boiler temperature is %ld degrees.",
BoilerTemp)
The value of the 'BoilerTemp' point is inserted into the specified text at the position marked by the
formatting characters (%ld) and then stored in the point 'TextPoint'.
If the value of 'BoilerTemp' was 57 then the resultant text that is stored in 'TextPoint' is as follows:
"Boiler temperature is 57 degrees."
TextPoint = FormatText ("Boiler %ld temperature is %ld degrees.",
BoilerNo, BoilerTemp)
The value of 'BoilerNo' point is inserted at the first '%ld' marker and the value of the 'BoilerTemp'
point is inserted at the second '%ld' marker and the resulting string is stored in the point 'TextPoint'.
If the value of 'BoilerNo' was 7 and the value of 'BoilerTemp' was 43 then the resultant text stored
in the 'TextPoint' is as follows:
"Boiler 7 temperature is 43 degrees."
Note:
The formatting characters are standard 'C' formatting characters (as used by the C-
language sprintf function). Some commonly used types are:
♦
♦
♦
♦
♦
♦
With the text left aligned, and with a width field (for instance '%-6ld' to insert a value left aligned
with a field 6 characters wide).
Revision 2.0
Type
text
A text point which holds the formatted text.
point
string
The text (with appropriate formatting characters) that the result
expression is inserted into.
Integer /
The value(s) or expression(s) that is inserted into formattext.
real
%ld. Insert integer value;
%f. Insert decimal value. Prefix with decimal point and number to control position
(for instance '%.2f' for 2 decimal places);
%s. Insert string;
%IX. Insert hexadecimal value (upper case HEX characters, for instance 'FFFF');
%lx. Insert hexadecimal value (lower case HEX characters, for instance 'ffff');
%c. Insert character (can be used to convert value to character, for instance to
insert control character).
CHAPTER 6 – Functions and Methods
Description
Page 93
Need help?
Do you have a question about the CX-SUPERVISOR - SCRIPT REFERENCE REV2.0 and is the answer not in the manual?
Questions and answers