Placeholders with Format Definition in the Output Text¶
A character string that is output in the visualization can include the placeholder %
for a variable. At runtime, the placeholder is replaced by the current value of the variable in the defined format. The data type in the format definition and of the variable must be identical. A character string can contain a maximum of one placeholder.
Character strings for output are listed in the Text variable property.
property. The associated variable is listed in theSee also
- Integer data types: Integer Data Types
- REAL/LREAL Data Type: REAL / LREAL
- Time data types: Time Data Types
Printing integers
|
Printing a variable (integer data type) as a decimal number | Code: Property Text: Property Text variable: Output: |
%b |
Printing a variable (integer data type) as a binary number | Code: Property Text: Property Text variable: Output: |
%o |
Printing a variable (integer data type) as an unsigned octal number without a preceding zero | Code: Property Text: Property Text variable: Output: |
%x |
Printing a variable (integer data type with maximum 32 bits) as an unsigned hexadecimal number without a preceding “0x” | Code: Property Text: Property Text variable: Output: |
|
Output of a 64-bit variable ( Note: |
Code: Property Text: Property Text variable: Output: |
%u |
Printing a variable (integer data type) as an unsigned decimal number | Code: Property Text: Property Text variable: Output: |
Printing floating-point numbers
Floating-point numbers have the data type REAL
or LREAL
.
%f |
In decimal form with decimal point in format 1.6 | Code: Property Text: Property Text variable: Output: |
%<alignment><minimum width>.<accuracy>f |
As decimal number in user-defined format
|
Code: Property Text: Property Text variable: Output: |
%e |
Printing a floating-point number (REAL or LREAL ) in exponential notation of base 10 |
Code: Property Text: Property Text variable: Output: |
%E |
Code: Property Text: Property Text variable: Output: |
Printing text
%c |
Printing a single character in ASCII | Code: Property Text: Property:guilabel:Text variable: Output: |
%s |
Printing a character string | Code: Property Text: Property Text variable: Output: |
Printing the percent sign
%% |
Printing the percent sign in a character string | Property Text: Output: |
Code: Property Text: Property Text variable: Output: |
Printing the date and time
If the output text in the element property Text variable, then the system time is printed; otherwise it is the value of the variable.
contains the placeholder “%t”, then a date and/or time is printed. If a variable is not specified in the propertyTime data types include LTIME
, TIME
, TIME_OF_DAY
, TOD
, DATE
, DATE_AND_TIME
, and DT
.
Date and time formats | ||
%t[yyyy] |
Years with century (4 digits) | Code: Property Text: Property Text variable: Output: |
%t[yy] |
Years without century (00-99) | Code: Property Text: Property Text variable: Output: |
%t[y] |
Years without century (0-99) | Code: Property Text: Property Text variable: Output: |
%t[MMMM] |
Months as a full name | Code: Property Text: Property Text variable: Output: |
%t[MMM] |
Months as an abbreviated name | Code: Property Text:: Property Text variable: Output: |
%t[MM] |
Months as a number (01 – 12) | Code: Property Text:: Property Text variable: Output: |
%t[M] |
Months as a number (1 – 12) | Code: Property Text:: Property Text variable: Output: |
%t[ddddd] |
Days of week as a number (1=Monday to 7=Sunday) | Code: Property Text:: Property Text variable: Output: |
%t[dddd] |
Days of week as a full name | Code: Property Text:: Property Text variable: Output: |
%t[ddd] |
Days of week as an abbreviated name | Code: Property Text:: Property Text variable: Output: |
%t[dd] |
Days in month as a number (01 – 31) | Code: Property Text:: Property Text variable: Output: |
%t[d] |
Days in month as a number (1 – 31) | Code: Property Text:: Property Text variable: Output: |
%t[jjj] |
Days in year as a number (001-366) | Code: Property Text:: Property Text variable: Output: |
%t[HH] |
Hours in 24-hour format (00-23) | Code: Property Text: Property Text variable: Output: |
%t[hh] |
Hours in 12-hour format (01-12) | Code: Property Text: Property Text variable: Output: |
%t[mm] |
Minutes with leading zeros (00-59) | Code: Property Text: Property Text variable: Output: |
%t[m] |
Minutes without leading zeros (0-59) | Code: Property Text: Property Text variable: Output: |
%t[ss] |
Seconds with leading zeros (00-59) | Code: Property Text: Property Text variable: Output: |
%t[s] |
Seconds without leading zeros (0-59) | Code: Property Text: Property Text variable: Output: |
%t[ms] |
Milliseconds without leading zeros (0-999) | Code: Property Text: Property Text variable: Output: |
%t[us] |
For LTIME variables only: microsecond definition (0-999) |
Code: Property Text: Property Text variable: Output: Tip: Overflow is permitted in the greatest time unit of a definition. |
%t[ns] |
For LTIME variables only: nanosecond definition (0-999) |
|
%t[t] |
If the value is a time < 12h, then A is printed; otherwise P is printed. |
Code: Property Text: Property Text variable: Output: |
%t[tt] |
If the value is a time < 12h, then AM is printed; otherwise PM is printed. | Code: Property Text: Property Text variable: Output: |
%t[' '] |
If character strings should be printed that correspond to a format definition, then these must be represented in single straight quotation marks. | |
The format definitions can be represented in a series. | ||
%t[HH:mm:ss:ms] |
Printing the complete time | Code: Property Text: Property Text variable: Output: |
%t[yyyy-MM-dd dddd] | Printing the date and day of the week | Code: Property Text: Property Text variable: Output: |
See also
- Time data types: Time Data Types