February 15, 2012

RegionToX and XToRegion - XpressDox

These two functions work in tandem in those situations where calculations are to be done and the formats of the numbers involved need to be converted from regional-settings compliant format to a format where they can be used in the calculation. This latter format is referred to as “XSLT compliant”. The article Calculations and Regional Settings describes this in detail.

RegionToX

This will convert a number which is known to conform to the regional settings so that it can be used in a calculation, for example:

«SetVr('ExtendedPrice',RegionToX(UnitPrice) * RegionToX(Quantity))»

XToRegion

Use this to convert the result of a calculation so that it is rendered in a format that conforms to the regional settings:

«FormatNumber(XToRegion(GetV('ExtendedPrice')),'','EU')»

The contents of this article apply to Version 4 (and later) of XpressDox.