NumText

Use this function to convert a numeric value into a series of descriptive words.

Syntax

NumText (Number, DollarWord, CentWord, DeciMode)

Parameter

Description

Number

Enter an amount. The default is the value of the current field.

DollarWord

Enter the word you want the system to use to describe the main unit of currency. The default is:

"dollars and"

CentWord

Enter the word you want the system to use to describe the secondary unit of currency. The default is:

"cents"

DeciMode

Choose from these options:

1 - numeric decimal amount
2 - spell decimal amount
3 - suppress zero, numeric decimal amount
4 - suppress zero, spell decimal amount

The default is one (1).

The system returns the written word equivalent of a numeric value.

The system attempts to remove formatting information from the parameter number. If the value after deformatting is not a valid number, the function returns an empty result.

This function is basically designed to produce the text that might appear on a bank check. The default type strings are dollars and and cents. When the default descriptions are used, this function uses the singular word dollar or cent when the associated value is 1, otherwise it uses the plural text. Alternate descriptions provided as parameters are not changed for any value amount.

The optional decimode parameter is an integer value from 1 to 4. This parameter includes or suppresses the zero (0) decimal value. You can also use this parameter to specify if the decimal amount should be presented as a number or spelled out.

Note This function only supports two decimal places. Additional places are truncated without rounding.

Example

Here are some examples (assume the current field value is 1641.56):

Function

Result

Explanation

NumText ( )

One thousand six hundred forty-one dollars and 56 cents

Defaults to dollars and cents and numeric decimal result.

NumText( , , , 2)

One thousand six hundred forty-one dollars and fifty-six cents

Decimal mode 2 spells the decimal amount.

NumText( 12.00, , ,3)

Twelve dollars

A decimal mode of 3 suppresses the zero decimal.

NumText(34.55,"meters and","centimeters",3)

Thirty four meters and 55 centimeters

Demonstrates substituting alternate references.

NumText(1.00,,, )

One dollar

 

NumText(1.01,,,)

One dollar and one cent

 

NumText(1.00,"meters and","centimeters",3)

One meters and

 

NumText(1.01,"meters and","centimeters",3)

One meters and one centimeters

 

If you include Dollarword and Centword and the number does not contain a decimal, the exact content you specify in Dollarword is printed and the system does not distinguish the number from being singular or plural. The Dollarword and Centword are printed exactly as specified. Notice the difference in the default format (dollars and cents) in the last two examples.

See also