Skip to main content
Skip table of contents

setSimpleNumberFormat

Creates a format that can be used with Number values. This differs from the setNumberFormat command by not requiring a formatting pattern to be specified, instead providing a somewhat simpler set of attributes for defining the formatting properties.

This command is also the recommended option for producing a Number format to be used by HTML content commands of the "bound" family, such as bound-content.

Attributes

name

Required

Value type

EL-evaluated

No

String

Yes

Defines a name for the created format. If defined, other commands can choose to use this format by referring to it by this name.  

Leaving the created format nameless declares it as the default format for Number values. Any command that prints out a Number value will then use this format, unless the command specifies a named format for itself. If a default format for Number values has already been set, this new format will take its place as the default.

locale

Required

Value type

EL-evaluated

No

String

Yes

Specifies a locale for this format, affecting the formatting rules. The resolved String should be an ISO-639 language code and an ISO-3166 country code, joined by a hyphen or an underscore (eg. "en-US" or "en_US"). Alternatively the value may only specify the language code, but this may lead to unpredictable results if this format requires the country information.

If not defined, the format will follow the user's default locale.

fractionDigits

Required

Value type

EL-evaluated

No

String

Yes

Defines the amount of digits in the fractional part of the formatted Number value.

If not defined, a locale-dependent default value will be used.

trimFraction

Required

Value type

EL-evaluated

No

Boolean

Yes

Defines if trailing zeros in the formatted Number value's fractional part are removed. If the resolved value is "true", any trailing zeros are removed. Note that this may cause the amount of fractional digits to become less than what the fractionDigits attribute defines.

If not defined, value of "false" is used and any trailing zeros will remain.

useGrouping

Required

Value type

EL-evaluated

No

Boolean

Yes

Defines if the digits in the integer part of the formatted Number value are grouped, should the amount of digits be high enough. If the resolved value is "true", grouping is used.

If not defined, a locale-dependent default value is used.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.