The FormatPercent function is a built-in function that generates a Text output of the specified Decimal value, followed by '%' using dec_digits after the decimal point. The decimal point is specified using dec_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

Output parameters

Text Type

Examples

Usage

Result

FormatPercent( 0.12, 3, "#" )

"12#000%"

FormatPercent( 0.124, 0, "," )

"12%"

FormatPercent( 0.125, 0, "," )

"13%" (in a .NET application server) or "12%" (in a J2EE application server)

FormatPercent( 0.1251, 0, "," )

"13%"

FormatPercent( 0.135, 0, "," )

"14%"

FormatPercent( 12345.6789, 2, "," )

"1234567,89%"

FormatPercent( -12345.6789, 2, "," )

"-1234567,89%"

See Also

Available Formatting Functions | Available Built-in Functions