The FormatDecimal function is a built-in function that builds a Text output of the specified Decimal value, using dec_digits after the decimal point. The decimal point is specified using dec_separator, while the thousands can be separated with the grp_separator.

When rounding, the function behaves differently depending on the application server you are using or where the function is used:

- In a .NET application server, applies the method round half up (rounds to the nearest integer, 0.5 rounds up).

- In a J2EE application server, applies the method round half to even (rounds to the nearest integer, 0.5 rounds to the nearest even integer).

Input parameters

value: Decimal Type

dec_digits: Integer Type

dec_separator: Text Type

grp_separator: Text Type

Output parameters

Text Type

Examples

Usage

Result

FormatDecimal( 1.2, 1, "$", "." )

"1$2"

FormatDecimal( 1.2, 3, ",", "." )

"1,200"

FormatDecimal( 1.24, 1, ",", "." )

"1,2"

FormatDecimal( 1.25, 1, ",", "." )

"1,3" (in a .NET application server) or "1,2" (in a J2EE application server)

FormatDecimal( 1.251, 1, ",", "." )

"1,3"

FormatDecimal( 1.35, 1, ",", "." )

"1,4"

FormatDecimal( 12345.67, 2, ",", "." )

"12.345,67"

FormatDecimal( -12345.67, 2, ",", "." )

"-12.345,67"

See Also

Available Formatting Functions | Available Built-in Functions