SPELL_NUMBER

Converts a number into words

Usage

SPELL_NUMBER(number, [round_to])

Parameters

number

(Required) The number to spell out

round_to

Numbers must first be rounded to avoid infinite decimals (0.33333…). This value is passed to ROUND(). Default is 10, max is 100.

Examples

Example With these variables Result

SPELL_NUMBER(123)

(None)

“one hundred and twenty-three”

SPELL_NUMBER(amount)

amount is 4567.36

“four thousand, five hundred and sixty-seven point three six”

SPELL_NUMBER(temperature)

temperature is -15

“negative fifteen”

SPELL_NUMBER(price, 5)

price is 2799.99

“two thousand, seven hundred and ninety-nine point nine nine”

SPELL_NUMBER(price, 2)

price is 2799.99

“two thousand, seven hundred and ninety-nine point nine nine”

SPELL_NUMBER(price, 1)

price is 2799.99

“two thousand, eight hundred”

SPELL_NUMBER(2020000)

(None)

“two million, twenty thousand”

More information

Important note: DocuMold needs to know the language of the document. See the @LANGUAGE action documentation for more details. The examples above assumed language is set to English.

For decimal numbers, the function spells out the whole part and the decimal part separately, using the word “point” to indicate the decimal separator.

Reminders

A text containing digits is not handled as a number. To have an actual number:

  • use the @NUMBER_QUESTION to set the variable
  • write a numeric value directly in the code without quotes, ex: age >= 18
  • use a function which converts to a number: NUMBER(text_containing_numbers)
  • use a function which returns a number: FIND("world", "hello everybody")

See also