Value Box Formatting Options (version 23)
The Value Box control can be configured to display the Value, Timestamp, or Quality of tag by using the 'ValueFormat' property. Parameters are formatted using C#'s string.Format() method.
Value
By default, the value box is set to display the value of the tag with 2 decimals places, {Value:N2}, where N is a single alphabetic character called the format specifier and 2 is an optional integer called the precision specifier. Below are the supported formats.
Format Specifier |
Name |
Description |
Example |
C |
Currency |
A currency value that supports all numeric types |
Raw Value: 123.456 Format: {Value:C2} Result: $123.46 |
D |
Decimal |
Supports integral types only |
Raw Value: 123 Format: {Value:D4} Result: 0123 |
E |
Exponential |
Exponential notation that supports all numeric types |
Raw Value: 123.456 Format: {Value:E3} Result: 1.235e+002 |
F |
Fixed-Point |
Number of decimal digits that supports all numeric types |
Raw Value: 123.456 Format: {Value:F1} Result: 123.5 |
G |
General |
Number of signicant digits that supports all decimal types |
Raw Value: 123.456 Format: {Value:G3} Result: 123 |
N |
Number |
Number of decimal places that supports all numeric types |
Raw Value: 123.456 Format: {Value:N2} Result: 123.46 |
P |
Percent |
Number multiplied by 100 that supports all numeric types |
Raw Value: 123.456 Format: {Value:P3} Result: 12345.600% |
X |
Hexadecimal |
A hexadecimal string that supports integral types only |
Raw Value: 123 Format: {Value:X3} Result: 07B |
Time
DateTime formatting can be achieved using the format {Time:Pattern} where Pattern is supplied such that
- yyyy = 4 digit year
- MM = number of month
- dd = number of day
- HH = hours using a 24 hour clock
- hh = hours using a 12 clock
- mm = minutes
- ss = seconds
- tt = AM/PM
Ex: {Time:M/dd/yy hh:mm tt} = 1/01/21 12:00 AM
Additional formatting options can be found by searching for C# custom date time formats. If no pattern is specified, the entire timestamp will be shown including the GMT offset.
Ex: 1/1/2021 12:00:00 AM -04:00
Quality
Setting the ValueFormat property to {Quality} will display a readable quality within the value box such as Good, Bad, Uncertain, or NoData.