Switch to: V11V10V9V8V7V6V5

Report Editor - Formatting Numbers Help

You can change output format for following controls, if they represents a numeric data:

Number Kind

For numeric data, you can choose one of the common numbers formats using the kind property of a control:

  • Auto – auto format for the current control.
  • Currency – format, that represents data as the amount of money of the current locate.
  • Number – format, that represents data as simple number.
  • Percentage – format, that represents data in percentage, for the current locale or for a specified locale.
  • Scientific – format, that represents data in scientific form, for the current locale or for a specified locale.
  • RuleBasedDuration – format, that represents data as duration in seconds as hours, minutes, and seconds (123 is “2:03”).
  • RuleBasedOrdinal – format, that represents data with ordinal suffix at the end of a numeral (123 is “123rd”).
  • RuleBasedPattern – format, that uses custom pattern to represent data (Not implemented yet).
  • RuleBasedSpellOut – format, that represents data as words (123 is “one hundred twenty-three”).

EXAMPLE:

In the following table you can see how each format displays number 12345.

Kind Output
Auto 12345
Currency $ 12345.00
Number 12345
Percentage 1234500%
Scientific 1.234500E+004
RuleBasedDuration 3:25:45
RuleBasedOrdinal 12,345th
RuleBasedSpellOut twelve thousand three hundred forty-five

Number Pattern

In addition to using the common kinds of formatting, Valentina Report engine allows to format numeric data according to a specified pattern. You can get acquainted with the principles of date formatting in the official page of Icu Library. Here you can find basic rules of compilation patterns, and examples of available patterns.

A pattern is a string of characters, where specific strings of characters are replaced with digits from a source field or expression control. You can apply pattern to control which has Auto or Number kind.

Symbol Location Meaning
0 Number Digit
1-9 Number '1' through '9' indicate rounding.
@ Number Significant digit
# Number Digit, zero shows as absent
. Number Decimal separator or monetary decimal separator
- Number Minus sign
, Number Grouping separator
E Number Separates mantissa and exponent in scientific notation. Need not be quoted in prefix or suffix.
+ Exponent Prefix positive exponents with localized plus sign. Need not be quoted in prefix or suffix.
; Subpattern boundary Separates positive and negative subpatterns
% Prefix or suffix Multiply by 100 and show as percentage
\u2030 Prefix or suffix Multiply by 1000 and show as per mille
¤ (\u00A4) Prefix or suffix Currency sign, replaced by currency symbol. If doubled, replaced by international currency symbol. If tripled, replaced by currency plural names, for example, “US dollar” or “US dollars” for America. If present in a pattern, the monetary decimal separator is used instead of the decimal separator.
' Prefix or suffix Used to quote special characters in a prefix or suffix, for example, “'#'#” formats 123 to “#123”. To create a single quote itself, use two in a row.
* Prefix or suffix boundary Pad escape, precedes pad character

A pattern may contain a positive and negative subpattern, for example, “#,##0.00;(#,##0.00)”. Each subpattern has a prefix, a numeric part, and a suffix. If there is no explicit negative subpattern, the negative subpattern is the localized minus sign prefixed to the positive subpattern. That is, “0.00” alone is equivalent to “0.00;-0.00”. If there is an explicit negative subpattern, it serves only to specify the negative prefix and suffix; the number of digits, minimal digits, and other characteristics are ignored in the negative subpattern. That means that “#,##0.0#;(#)” has precisely the same result as “#,##0.0#;(#,##0.0#)”.

The grouping separator is a character that separates clusters of integer digits to make large numbers more legible. It commonly used for thousands, but in some locales it separates ten-thousands. The grouping size is the number of digits between the grouping separators, such as 3 for “100,000,000” or 4 for “1 0000 0000”. There are actually two different grouping sizes: One used for the least significant integer digits, the primary grouping size, and one used for all others, the secondary grouping size. In most locales these are the same, but sometimes they are different. For example, if the primary grouping interval is 3, and the secondary is 2, then this corresponds to the pattern “#,##,##0”, and the number 123456789 is formatted as “12,34,56,789”. If a pattern contains multiple grouping separators, the interval between the last one and the end of the integer defines the primary grouping size, and the interval between the last two defines the secondary grouping size. All others are ignored, so “#,##,###,####” == “###,###,####” == “##,#,###,####”.

Examples

Let's consider few examples of how will be presented number 1234567.8901, using several patterns:

Pattern Output
#,##0.## 1,234,567.89
#,##0.#### 1,234,567.8901
#,###0.##### 123,4567.8901
###0.000000 1234567.890100
#,##0.## ¤ 1,234,567.89 $
'#'### #1234568
@@ 1200000