Formatters
Formatters control the output of numbers, angles, strings, calendar time values and timespans. They always start with a '%' character, which is followed by a code, such as %5.3g.
Standard Formatters
The standard formatters %? and %&? output any data types in a standard format. Floating point values are output using a number of valid places that can be set on the General tab in the Properties dialog box of the FlexPro project database. If you use a variant with the & character, data with a unit is output with the unit appended.
Numerical Value
This formatter controls how numerical data is displayed. You can choose from a variety of formatting options. You can align the digits in a field, specify whether an exponent should be displayed and if so, in which format and basis, specify the number of places after the decimal point, and much more.
Syntax
%[Attribute][Field size][.Places]Formatter
The syntax of the numerical value formatter consists of the following elements:
Element |
Description |
||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Attribute |
One or more of the following attribute characters:
|
||||||||||||||||||||
Field size |
Specifies with size (width) of the field into which the formatted number is to be placed as either left or right aligned. If necessary, it is filled with spaces. The entire number is always output, even if the Field size was not specified or a smaller size was specified. If applicable, the appended unit is ignored for the alignment and is instead placed after the aligned numerical value. |
||||||||||||||||||||
Places |
Depending on the formatter chosen, this selects the number of valid places or fractional digits. If you omit the element, the value preset on the General tab of the project database Properties dialog box is used. |
||||||||||||||||||||
Formatter |
* Use lower case letters to output the exponent in superscript. Example: 10³ or 2³. Otherwise, E+003 or B+003 will be output, for instance. |
Indexed Text
This formatter offers you the option of assigning texts to numerical values starting at 0, which are then displayed instead of the numbers. You can thus label the columns of a column chart, for instance, with individual text. Do not confuse this formatter with the string formatter, which cannot display any numerical data.
Syntax
%("Text0"[, "Text1"[, ..., "Textn"]])
The syntax of the formatter for indexed text consists of the following elements:
Element |
Description |
---|---|
Text0 ... Textn |
The text to be output instead of the values 0 through n. |
Calendar Time
FlexPro saves calendar times (date and time) as numerical values that contain the number of seconds since January 1, 1970 in "Universal Time Coordinated" (UTC). Using a calendar time formatter, you can display these numerical values as a calendar time. FlexPro converts the UTC values automatically to the time zone set in Windows Regional and Language Options. You can, however, specify an option that is to result in output in universal time coordinated. The formatter specifies which time value elements should be displayed. There is a corresponding formatting element for each of the elements listed below. This formatting element starts with a % character. You can write any text between the individual formatting elements, where a percent sign has to be entered as %%.
Syntax
%[.Fractional digits]([UTC] Date)
The syntax of the calendar time formatter consists of the following elements:
Element |
Description |
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Fractional digits |
Selects the maximum number of fractional digits for seconds. If you omit the element, then the default value used is 6, which is equivalent of a 1µs resolution. |
||||||||||||||||||||||||||||||||||||||||||||||||
UTC |
Outputs the date as Universal Time Coordinated (UTC). |
||||||||||||||||||||||||||||||||||||||||||||||||
Date |
Any text in which the following element formatters can be embedded:
|
Examples
%(%A, the %th of %B %Y %H:%M) |
An example of this output would be: "Tuesday, the 16th of February 2010 17:15". |
%(UTC%A, the %th of %B %Y %H:%M UTC) |
An example of this output would be: "Tuesday, the 16th of February 2010 04:15:00 PM" |
%.0(%H:%M:%S) or %.0(%X) |
Outputs only the time, so the seconds are output without fractional digits. |
Timespan
Timespans can be formatted as H:M:S or D:H:M:S . The number of fractional digits as well as the number of places for the hour or day can be adjusted.
Syntax
%[Places][.Fractional digits]Formatter
The syntax of the timespan formatter consists of the following elements:
Element |
Description |
||||
---|---|---|---|---|---|
Places |
Specifies the number of digits for the day or hours. If necessary, it is filled with leading zeros. |
||||
Fractional digits |
Selects the maximum number of fractional digits for seconds. If you omit the element, then the default value used is 6, which is equivalent of a 1µs resolution. |
||||
Formatter |
|
Examples
%3.2t |
Formats the timespan as HHH:MM:SS.ss. |
%.0T |
Formats the timespan as D:HH:MM:SS. The seconds are output without fractional digits. |
Angle
Angles can be displayed in degrees, minutes, seconds (° ´ ´´) or as a fraction of π. The existing angle data can be formatted in degrees or radians.
Syntax
%[.Places]Formatter
or
%[.Denominator]Formatter
The syntax of the angle formatter consists of the following elements:
Element |
Description |
||||
---|---|---|---|---|---|
Places |
When outputting in degrees, minutes, seconds, the maximum number of digits is specified for the seconds. If you omit the element, the default value 6 is used. |
||||
Denominator |
Outputting as a fraction of π specifies the denominator of the fraction. If you omit the element, then instead of outputting a fraction, a decimal number with the maximum number of fractional digits predefined on the General tab of the project database Properties is output. |
||||
Formatter |
Use upper case letters if the data to be formatted is in radians (0 to 2 π) and lower case letters if the data is in degrees (0 to 360). |
Examples
%.2r |
An example of this output would be: "15° 12´ 24,34´´". |
%.4P |
An example of this output would be: "3/4 π". |
%P |
An example of this output would be: "0.75 π". |
String
You can limit strings to a maximum length or fill them up to a minimum length. The text can be displayed as left or right justified.
Syntax
%[-][MinFieldSize][.MaxFieldSize]s
or
%[-][MinFieldSize][.MaxFieldSize]S
The syntax of the string formatter consists of the following elements:
Element |
Description |
||||
---|---|---|---|---|---|
- |
If specified, the field alignment is left-justified; otherwise, it is right-justified. |
||||
MinFieldSize |
Specifies the minimum field size in characters. The value is only relevant if the string is shorter than the specified value. It is then filled with spaces. |
||||
MaxFieldSize |
Specifies the minimum field size in characters. The value is only relevant if the string is longer than the specified value. Excess characters are then cut off. |
||||
Formatter |
|
Examples
%s |
An example of this output would be: "Test". |
%.3s |
An example of this output would be: "Tes". |
%6s |
An example of this output would be: " Test". |
Special Format
The following special formats are suitable in particular for numbering in tables and for chapter titles in documents.
Syntax
%Formatters
The syntax of the special format formatter consists of the following elements:
Element |
Description |
||||||||
---|---|---|---|---|---|---|---|---|---|
Formatters |
|
Examples
%a |
1, 2, 3, 4 is formatted as a, b, c, d. |
%A |
1, 2, 3, 4 is formatted as A, B, C, D. |
%o |
1, 2, 3, 4 is formatted as i, ii, iii, iv. |
%O |
1, 2, 3, 4 is formatted as I, II, III, IV. |
%c |
1, 2, 3, 4 is formatted as 一, 二, 三, 四. |
%C |
1, 2, 3, 4 is formatted as 壹, 贰, 叁, 肆. |
%j |
1, 2, 3, 4 is formatted as 一, 二, 三, 四. |