Index
NumberPhrase
Tutorial Videos
Tutorial videos are available here.
Knowledge Base
Visit our User Forum for discussions & solutions
NumberPhrase - XpressDox
NumberPhrase is used to convert a number to words, in several different languages.
Command structure:
«NumberPhrase(Area,'','leave')»
Examples of usage:
«NumberPhrase(Area,"en-us","ToUpper")»
Suppose a data element with name ‘Area’ has a value 1234:
This would yield “ONE THOUSAND TWO HUNDRED THIRTY-FOUR”
Parameters:
Languages supported are ‘en’ (US English, the default), ‘fr’ (French), ‘de’ (German), ‘en-uk’ , ‘af’ (Afrikaans) and ‘en-za’ (English, South Africa, which renders 1.10 as ‘One Comma One Zero’).
The ‘ToUpper’ parameter is obvious, and could also be ‘ToLower’, or ‘Leave’ (which is the default).
The command NumberToWords is equivalent to NumberPhrase in all respects.
Note:
If a number which has a NumberPhrase on it is left blank, then an error is thrown and the document is not assembled, the reason being is to prevent unwanted text in the assembled document. It is to avoid such text as ‘NaN’ (Not a Number) or ‘invalid number’ printing on the document, with no warning to the user.
Here are some suggestions to improve the user experience and prevent errors:
1. Set a default value with SetInitialValue, or the Set command.
2. Make the data element required.
3. Put a test on the data element and only use NumberPhrase if there is a value to convert. Like this: «If(not(ValueIsEmpty(Num)))»«NumberPhrase(Num,’en-us’,’leave’)»«End()»