Mask Number

Kalipso - Form - Expressions - Functions - Functions Descriptions - Numeric Functions - Mask Number

This Function returns a <string>, composed by the Value formatted according to the remaining parameters.

Parameters

  • Value <numeric> - Number to format.

  • Sign <numeric> - Display the sign at left of the Value. It can be one of:

    • Minus - Display only if it's a negative Value.

    • Always - Always display the sign.

    • Never - Never display the sign.

  • Add Thousand Separator <boolean> - Display the Value with the thousand separator?

  • Thousand Separator <string> - Char to represent the thousand separator.

  • Round <boolean> - Round the value?

  • Decimal Places <numeric> - Number of decimal places to round if the Round parameter is true.

    Number of decimal places to add zeros to the right if Add Right Zeros parameter is true.

  • Decimal Separator <string> - Char to represent the decimal separator.

  • Add Right Zeros <boolean> - Use char "0" to complete the Value at right in order to achieve the number of Decimal Places to display.

Examples

  • Example 1

MaskNumber("-10000", MINUS, TRUE, ".", FALSE, 0, "", FALSE) Result = -10.000

  • Example 2

MaskNumber("-10000", ALWAYS, TRUE, ".", FALSE, 0, "", FALSE) Result = -10.000

  • Example 3

MaskNumber("-10000", NEVER, TRUE, ".", FALSE, 0, "", FALSE) Result = 10.000

  • Example 4

MaskNumber("10000", ALWAYS, TRUE, ".", FALSE, 0, "", FALSE) Result = +10.000

  • Example 5

MaskNumber("10000.5", MINUS, TRUE, ".", TRUE, 1, ",", FALSE) Result = 10.000,6

  • Example 6

MaskNumber("10000.55", MINUS, TRUE, ".", TRUE, 3, ",", FALSE) Result = 10.000,55

  • Example 7

MaskNumber("10000.55", MINUS, TRUE, ".", TRUE, 3, ",", TRUE) Result = 10.000,550

  • Example 8

MaskNumber("10000.55", MINUS, TRUE, ".", FALSE, 1, ",", TRUE) Result = 10.000,55

If Round is false, Add Right Zeros is true, and the decimal places in the Value are more than Decimal Places parameter, the decimal part will remain unmodified (see Example 8).

Last updated