Tutorial Videos

Tutorial videos are available here.

Knowledge Base

Visit our User Forum for discussions & solutions

FormatNumber – XpressDox

Apply formatting to a numeric value in your XpressDox template


The FormatNumber function applies formatting to a numeric value. The FormatNumber function takes a format string as a parameter. Consider the example:


The , indicates the position of the thousands delimiter and the . indicates the position of the decimal place. This format string also indicates the amount should be formatted to 2 decimal places. The resulting number will then be formatted according to your regional settings. In some countries that may look like 1,234.56; in others it may be 1 234,56.


Note that FormatNumber applies formatting to the number in the assembled document, and FormatNumberOnInput applies formatting to the number in the interview. FormatNumber also forces a numeric rule onto the data element i.e. users will not be able to type non-numeric values into numeric fields on an interview.


All parameters in the FormatNumber function:

«FormatNumber(Purchase_price,’#,##0.00;-#,0.00′,’EN’,’An empty number was entered’)?Some help text»


Parameter Value in the above command
How to format positive values #,##0.00
How to format negative values -#,0.00
Force the number into a specific region format e.g. 1,234.56 EN *
What to insert on the document if the value is empty An empty number was entered
Help text on the interview Some help text


*Note that the decimal format code “ZA” is required to indicate that the decimal point and thousands separator should be according to official South African format (as required, for example, by the South African Deeds Registry). Note also that the decimal format code “EU” will format the number according to European decimal rules, that is a full stop as the thousands separator and a comma as the decimal point.
Other options for the decimal format code (or zone) are: “US” (the default), “FR” which is the same as “ZA”, and “CX” which will render the thousands separator as a space and the decimal as a full stop (period).



Selecting from the Command Assistant:

When using this function from the Command Assistant; a double click on FormatNumber will give you the “default” helper of the function which is the simple version. A single click on FormatNumber from the Command Assistant will allow you to choose more detailed helpers.



Related articles:

Please also see the article The RenderAsNumeric function which shows how to make sure that the value typed in by a user can be made to be numeric regardless of the format in which they enter the value. There is also a discussion in the article Tips and Hints using the Rule Command about using Rule together with FormatNumber.



The Question command in v14:

The concept of Low Code authoring was introduced in v14, and with that the Question command. It is now possible to insert a Number Question into the template without the need for FormatNumber. Inside the Question command, state that it is a number and select your desired format.