Formatting masks

There is implemented formatting of displayed values in the form of a format mask in the D2000 System. The basic syntax is usable for the Transformation palette. Extended syntax, which replenishes the basic syntax, is used to display the object in pictures.

Basic syntax

The mask defines the format of displayed numeric values. To create your own formats, you can use the following characters: ##, 0, $, E+, E-, e+, e-.

CharacterMeaning
#Enables the occurrence of a number (the number occurrence is not necessary). If the number is negative, the sign is to be placed on the first occurrence place of this character.
0Number occurrence required. If the number does not occur in the given place, it will be replenished by the character "0".
$Rounding-off.
E+, E-Exponential form. Exponent is quantified so that the mantissa would be less than 10.
e+, e-Exponential form (engineering notation). Exponent is quantified so that it is divisible by 3.
.Decimal point.

To format the exponent, it is possible to use the characters 0 and #. The system will execute automatically the conversion of the format mask according to the following rules:

  • after the first character $ from the left, the characters 0 and # are substituted by the character $,
  • between character 0 and the decimal point, the character # is substituted by the character 0.
Entered maskMask after conversion
##$$00##$$##00##$$$$$$$$$$$$
##00$$##$$##00##00$$$$$$$$$$
##00##00$$###000000$$$
##0#0.##0#####000.000###

After executing the aforementioned conversion, there are valid the following rules:

  • before the character #, placed before the decimal point, there is no occurrence of the character 0,
  • before the character #, there is no occurrence of the character $,
  • between the character 0 and the decimal point, there is no occurrence of the character #
  • before the character 0, there is no occurrence of the character $.

The overflow occurs if the displayed number (or number sign) is longer than the defined mask. After overflow, there is displayed the string of characters "<".

The examples of format masks are shown in the following table.

Object valueMaskDisplayed value
129{###}129
129{000}129
129{0000}0129
129{000.00}129.00
129{000$}0130
129{# # # #}1 2 9
1234{# ### K}1 234 K
1234{#-###}1-234
1234{###}<<<
123.6{###}124
123.6{###.#}123.6
123.6{###.$}124.0
-10{###}-10
-10{# ##}- 10
-10{##}<<
-10{# 000}- 010
-10{000}<<<
-10{##E+0}-1E+1
-10{##E+00}-1E+01
-10{##e+0}<<<<<
-10{###e+0}-10E+0

The following format marks are used to display the objects, the value of which is time type, and the time of object value occurrence.

MarkMeaning
yyyy or rrrrThe number of years (four digits).
yy or rrrrLast two digits of the year.
ddThe number of days (two digits).
mmThe number of a month.
hhHour
hhhThe number of hours - only for the relative time that does not contain a mask for days.
hhhhThe number of hours - only for the relative time that does not contain a mask for days.
hhhhhThe number of hours - only for the relative time that does not contain a mask for days.
hb, HHTrading hour - hour in a day from 1 to 25.
miMinute
ssSecond
mssMillisecond
ttttName of day in week *.
ttt3-character abbreviation of the day in week *.
tt2-character abbreviation of the day in week *.
ZZZUTC offset in hours using format "(+|-)hh".
ZZZZZUTC offset in hours and minutes using the format "(+|-)hhmi".
ZZZZZZUTC offset in hours and minutes using the format "(+|-)hh:mi".

For example, if the object SysTime (System tag) is connected (to view) to the text string:

{hh:mi:ss dd-mm-yyyy},

the text string will display time information in the format:

15:18:36 27-10-1998

If there is used the mask with the shortened format of year "yy", it will be modified to "yyyy". For example, if there is used the mask hh:mi:ss dd-mm-yy, when changing the value, it is modified on hh:mi:ss dd-mm-yyyy by the reason of the uniqueness of entering the year (19/20).

Date entry:

  1. If a mask contains both hh and hb marks, only hh mark will be used.
  2. In the text entry field, the hh mark is highlighted in white and hb mark in light yellow.

Note to days in aweek:
The names are displayed when using the transformation palette (I/O tags, user tags, structured variable items) in pictures, in Browser and in the functions %TimeToStr and %TimeToStrEx.
For displaying names of days, you can use the Dictionary - it will generate a text in particular language instead of the name of day according to the table:

Day\maskttttttttt
Monday{!Mo}{!Mon}{!Monday}
Tuesday{!Tu}{!Tue}{!Tuesday}
Wednesday{!We}{!Wed}{!Wednesday}
Thursday{!Th}{!Thu}{!Thursday}
Friday{!Fr}{!Fri}{!Friday}
Saturday{!Sa}{!Sat}{!Saturday}
Sunday{!Su}{!Sun}{!Sunday}

In the Dictionary, you must define keys (e.g. Mo, Tu, We, Th, Fr, Sa, Su if you use the mask tt) and set the language for individual users.
When using the functions %TimeToStr and %TimeToStrEx, you must apply the function %HI_LNG_Translate to the result.

Extended syntax

In pictures, there is possible to display individual parts of the complex value of D2000 System object - flags. The special text strings (graphic object Text), enclosed between combined brackets "{ }! - format masks, are used to display the values of attributes of linked objects. The mask defines the format of the displayed value.

MaskThe displayed attribute of linked object complex value
{A}Process alarm.
{D}Object description.
Note: In pictures, when displaying the object description for structure items, which contain indirect objects, there will be displayed the description of the indirect object instead of the structure description. If the indirect object is not used, there will be displayed in the column description.
{F}All attributes (flags) of the object value. Depending on the current value of the flag A up to P, there will be displayed:
  • the capital letter that represents the given flag (e.g. A) - if the flag value is TRUE,
  • the character "_" (underline) - if the flag value is FALSE.
{Fflags}Defined flags (attributes) of the object value. Unlike the mask {F}, in this case, there will be displayed only values of flags enumerated after the letter F - flags (e.g. {FACE}). Depending on the current value of the given flag, there will be displayed:
  • the capital letter that represents the given flag (e.g. A) - if the flag value is TRUE,
  • lower case letter that represents the given flag (e.g. b) - if the flag value is FALSE.
{L}User name. This mask can be used only for the Display mask.
{N}Object name.
Note: In pictures, when displaying the object name for structure items, which contain indirect objects, there will be displayed the name of the indirect object instead of the structure name. If the indirect object is not used, there will be displayed the structure name, row number and column name.
{T}Object value time.
{Tmask}Object value time together with the time mask.
{tmask}Numeric object value displayed as a time data according to the entered mask for time data.
{U}Technical units of the object.
Note: In pictures, when displaying the object technical units for structure items, which contain indirect objects, there will be displayed the technical units of the indirect object instead of the technical units of the structure.
{V}Object value - if the object has status text then the status text will be displayed, if not the object value will be displayed
{V+}Object value - if the object has status text then the status text is displayed and the value of the object is displayed in parentheses, if not the value of the object is displayed
{V-}Object value - the value of the object is displayed, even if the object has a status text
{PV}, {PU}, {PT}, {PTmask}, {Ptmask}, {PF}, {PFflags}The letter P, typed in the format mask, will display the previous value of a given attribute.
Warning: The letter O, used in format masks, can be used just for the definition of the Display mask.

Combined format masks


The aforementioned text of this topic describes the simple format mask, by means of which it is possible to display the value of one particular attribute of complex object value (e.g. object value, value occurrence time, ...). There can be also used as the so-called combined format masks, besides simple format masks. These masks, unlike simple ones, display values of several attributes of complex object value.

The combined format mask is defined within the frame of one text string inserted into the picture as graphic object Text.

The examples of combined format masks are shown in the following table.

MaskThe displayed attribute of linked object complex value
{N} {V}Name and value of the object.
{V} {U}Value and technical units of the object.
{N} {T} {F}Name, occurrence time and flags of the object.

Note 

  • In case there are defined both the mask for the given attribute (e.g. {V}, {T} ...) and the mask, defining own value format (e.g. {##.#}, {# ### K} ...) within the frame of one combined format mask, there is valid the mask with the value format.

The decimal point in the real numbers


Real numbers display in the D2000 HI

The decimal point in the real numbers is represented by a separator (in the D2000 HI only) as it is set in the Regional Settings. Both "full stop" and "comma" are supported.

Warning:

  • Do not set any other marks than "full stop" or "comma" as a decimal point in the Regional Settings.
  • In the definition of display mask, there is always used "full stop" to separate the integer part from the fractional one. It is, then, replaced by the mark from the Regional Settings. Therefore, we recommend you to use neither "comma" nor "full stop" for the thousands separator in the masks. For example, if you use the mask: "###,###.###,###", and in the regional settings is "comma" as a decimal point, you will get a strange value, for example "121,652,791,654".


Date and time display

As regards the unformatted outputs of times (e.g. value time), there is mostly used the setting as per the regional settings.

0 komentárov

Nie ste prihlásený. Akékoľvek zmeny, ktoré vykonáte, sa označia ako anonymné. Ak už máte svoj účet, pravdepodobne sa budete chcieť prihlásiť .