Documentation
Back to website >

Display-Format (Pascalscript)

A display format can be specified in the field definitions for fields in the SQL Registry and in the report designer.

These formats are subject to certain rules described here. In addition to display formats within the screen templates, the same output formats are used for the reports.

Displayformat

You can also define an edit format for screen fields that has the same structure as the display format. All display formats evaluate the international settings of the operating system. The Sytnax input is accordingly international (English).

Numeric fields, such as integer and floating point numbers, are differentiated in the formatting of date and time fields.

The syntax corresponds to the formatting used in the Delphi programming language.

 

Numeric fields

The following formats are possible for numeric fields.

0 Placeholder for digit. If the formatted value contains a digit at the position where the character 0 (zero) appears in the format string, the relevant digit is included in the output string. Otherwise, a zero appears at this position in the output string.
# Placeholder for digit. If the formatted value contains a number at the position where the character # appears in the format string, then this number is included in the output string. Otherwise, nothing is stored at the relevant position in the output string.
. Decimal point. The first dot in the format string determines the position of the decimal separator in the formatted value. All other dot characters are ignored. The character that actually appears as a decimal separator in the output string is defined Windows Control Panel under Regional Settings (Properties tab of Regional Settings, Numbers tab).
, Thousands separator. If the format string contains one or more comma characters, all digits to the left of the decimal separator in the output string are divided into groups of three, each separated by a thousand separator. To indicate that a thousand separator is desired, it does not matter how many commas the format string contains. The position is also arbitrary. The character that actually appears as a thousand separator in the output string is defined in Windows Control Panel under Regional Settings (Properties tab of Regional Settings, Numbers tab).
E+ Scientific notation. As soon as the format string contains one of the identifiers "E+", "E-", "e+" or "e-", the formatted number is displayed in scientific notation. Immediately after"E+","E-","e+" or"e-" a group of up to four zeros can follow, with which the minimum number of digits in the exponent is determined. The two abbreviations"E+" and"e+" have the effect that both positive and negative exponents are signed. The abbreviations "E-" and "e-" have the effect that only negative exponents receive a sign.
'xx'/"xx" All characters enclosed in half or whole quotation marks are copied unchanged into the output string and do not affect the formatting.
; A semicolon separates the ranges for positive and negative numbers in the format string.
$ Currency symbol placeholder. This symbol is only supported in the FormatFloatLCID routine and must be at the beginning or end of the format string. The position start or end has nothing to do with the position of the currency symbol created later. This is determined exclusively from Windows and the locale stored there. The LCID specifies the locale.

Within the format string, the position of the leftmost zero character together with the position of the rightmost zero character (related to the decimal separator) determines the number of digits that are always displayed in the output string.

During formatting, the number to be displayed is always rounded to the number of decimal places specified by the number of digit placeholders ("0" or"#") to the right of the decimal separator. If a decimal separator is missing in the format string, the formatted value is rounded to the next whole number.

If the specified number of places before the decimal point is not sufficient to represent a number, additional places are inserted before the first digit placeholder.

 

Display
format
Value Result Advice
#.## 12.2 12.2 to the left of the decimal point, the additional number is always displayed.
#.00 2.5 2.50 Additional zero: Two decimal places are always displayed.
00.## .006 00.01 To the right of the decimal point, additional zeros are displayed and rounded to two decimal places.

The semicolon divides the format string into up to three parts, in each of which you can define your own formatting for positive and negative numbers and for zeros.

  • One section: The format string applies to all values.
  • Two sections: The first section applies to positive values, the second to negative values.
  • Three sections: The first section applies to positive values, the second to negative values and the third to zeros.

If the section for negative values or the section for zeros is empty, that is, if there is nothing between the semicolons, the section for positive values is used instead.

If the section for positive numbers is empty or the entire format string is empty, a standardized floating point formatting with 15 significant digits is performed. The same applies if the value has more than 18 digits before the decimal point and no scientific notation has been specified in the format string.

Date fields

The following formats are possible for date fields.

c The date is represented by an internally defined format, followed by the time. The time is not displayed if the fraction after the decimal point of the date/time value is zero. Internally, a date is displayed as a floating point number. The integer display is the date, the fraction after the decimal point is the time.
d The day as a number without leading zero (1-31).
dd The tag as a number with leading zero (01-31).
ddd The day as an abbreviation (Sun-Sat)
dddd The day as full name (Sunday-Saturday)
ddddd Internal date short format is used.
dddddd Internal date long format is used.
m The month as a number without leading zero (1-12). If the identifier m immediately follows an h or hh, the month is displayed instead of the minute.
mm The month as a number with leading zero (01-12). If the identifier mm immediately follows a h or hh, the month is displayed instead of the minute.
mmm The month as an abbreviation (Jan-Dec).
mmmm The month as full name (January-December).
yy The year as a two-digit number (00-99).
yyyy The year as a four-digit number (0000-9999).
h The hour without leading zero (0-23).
hh The hour with leading zero (00-23).
n The minute without leading zero (0-59).
nn The minute with leading zero (00-59).
s The second without leading zero (0-59).
ss The second with leading zero (00-59).
t The time is determined by the internal short format.
tt The time is defined by the internal long format.
am/pm The time in 12-hour format for the preceding identifier h or hh, followed by"am" for the hours before noon or"pm" for the hours after noon. For the am/pm identifiers, upper or lower case letters as well as both can be used together. The result is displayed accordingly.
a/p The time in 12-hour format for the preceding identifier h or hh, followed by"a" for the hours before noon or"p" for the hours after noon. For the a/p identifiers, upper or lower case letters as well as both can be used together.
ampm The time in 12-hour format for the preceding identifier h or hh, followed by the internally defined name identifier.
/ The date separator, which is taken from the international setting of Windows.
: The time separator, which is taken from the international setting of Windows.
'xx'/"xx" Characters enclosed in half or whole quotation marks are displayed without further formatting.

You can use both upper and lower case letters as format identifiers. The result is the same in both cases.

If the string specified in the format parameter is empty, the date and time value is formatted as if the format identifier c were specified.

 

StringMask Fields

Symbol Meaning
! If the ! character is used in the mask, optional characters in the returned string are displayed as leading spaces. If the character ! is missing, optional characters in the returned string are displayed as concluding blanks.
> If the > character is used in the mask, all of the following characters up to the end of the mask or up to the character < uppercase.< />
< If the < character is used in the mask, all following characters up to the end of the mask or up to the character> lowercase.
<> If these two characters are used together in the mask, no case-sensitive check is performed and the characters are formatted as they appear in the Value parameter.
\ The character following \ is to be interpreted as a literal character. Use this character if you want to output one of the wildcard characters literally.
L The character L requires a letter at this position (in Germany A-Z and a-z).
l The character l allows only one letter at this position, but does not request it.
A The character A requires an alphanumeric character at this position.
a The character a allows an alphanumeric character at this position, but does not request it.
C The character C requires any character at this position.
c The character c allows but does not require any character at this position.
0 The character 0 requires a numeric character at this position.
9 The character 9 allows but does not require a numeric character at this position.
# The # character allows a numeric character or a plus or minus sign at this position, but does not require it.
: The character : is used to separate hours, minutes and seconds in time specifications. If the country settings in the system control of your computer provide another delimiter, this is used instead of :.
/ The / character is used to separate the year, month and day in dates. If the country settings in the system control of your computer provide another delimiter, this is used instead of /.
; The character ; separates the three fields of the mask.
_ The _ character automatically inserts spaces into the returned string.

Any character that is not contained in this table can be specified as a literal in the first part of the screen. Literal characters are inserted automatically if the second part of the mask is 0. For any other value in the second part of the mask, the literal characters are compared with the characters in the parameter Value. The wildcard characters themselves can also be used as literals if preceded by a backslash (\).

The second field of the mask contains a single character that specifies whether the literal characters of the mask are contained in the parameter Value. The mask for a telephone number with area code could look like this, for example:

(000)_000-0000;0;*

The 0 in the second field means that the parameter Value should consist of the ten digits of the telephone number, not of the 14 characters from which the final string is formed.

A 0 in the second field specifies that literals are inserted in the value string, all other characters specify that they are to be included. The character that determines whether literals are included can be changed in the typed constant MaskNoSave declared in the unit Mask.

The third field of the mask is the character used in the returned string for spaces (characters that do not appear in Value). By default, this is the same character that stands for literal spaces. The two characters are displayed identically in the return string.

Note

If you are working with multibyte character sets, each wildcard character represents one byte. So if you apply the wildcard characters L, l, A, a, C or c to double-byte characters, you must also duplicate the wildcard characters. For example, LL stands for two numeric single-byte characters or for a double-byte character. Only single-byte characters are supported as literal characters.