Value on a Number

This is the documentation for 3.2.3 version, which is not the latest version. Consider upgrading to 4.3.1.

Using value on a number is the proper way to format and output a number.

You have various options for formating:

  • by default it will format the number accordingly to the locale: 562407 will output 562,407 in en_US, 562 407 in fr_FR (thanks to numeral lib)

  • set AS_IS flag to true to avoid this formating

  • set TEXTUAL flag to true to transform the number into text: #[+value(5500, {'TEXTUAL':true })] will output five thousand five hundred

  • set ORDINAL_NUMBER flag to true to to transform the number into an ordinal number: #[+value(21, {'ORDINAL_NUMBER':true })] will output 21st

  • set ORDINAL_TEXTUAL flag to true to to transform the number into an ordinal text: #[+value(20, {'ORDINAL_TEXTUAL':true })] will output twentieth

  • use FORMAT to set a format directly used by numeral. See numeral.js formats. This is very practical for currencies, %, etc.

  • use agree for ORDINAL_TEXTUAL and TEXTUAL (in it_IT, es_ES and fr_FR), for instance to have prima and not primo, or un/une (default agreement is M)

  • use agree for ORDINAL_NUMBER in fr_FR to manage 1er / 1re

numeral takes into account the locale: +value(104000, {'FORMAT': '0a$'}) will output 104k€ (yes, €!) when generating French.

Decimal numbers are supported using TEXTUAL: 1.55one point five five in English. Same pattern for other languages.

Table 1. Number formatting support depending on languages
Feature en_US fr_FR de_DE it_IT es_ES

Default: standard number formatting

yes

yes

yes

yes

yes

TEXTUAL

yes

yes

yes

yes

yes

ORDINAL_NUMBER

yes

yes

yes

yes

yes

ORDINAL_TEXTUAL

yes

yes (up to 100)

yes (up to 1 million included)

yes

yes (up to 9999)

FORMAT

yes

yes

yes

yes

yes