How can I format a currency for our remote sites into a format with no decimal point?

GuiXT calls a function module for purchase requisition and this function module returns valuation in the following format "100000.0000". Prior to this new requirement I formatted this in the following way:

Set V[x] "&[reqtxt_wa](216-238)" + "0" Decimals="2"

DecimalSeparator="." GroupSeparator="," //Valuation price field

Now, I have had to build some logic so that I can handle this for different decimal formats:

//Set the format for this value based on user's decimal setting

if V[deckey=X]

Set V[x] "&[reqtxt_wa](216-238)" + "0" Decimals="2"

DecimalSeparator="." GroupSeparator="," //Valuation price field

else

if not V[deckey]

Set V[x] "&[reqtxt_wa](216-238)" + "0" Decimals="0"

DecimalSeparator="," GroupSeparator="." //Valuation price field

endif

if V[deckey=Y]

Set V[x] "&[reqtxt_wa](216-238)" + "0" Deicmals="0"

DecimalSeparator="," GroupSeparator=" " //Valuation price field

endif

endif

In the first case (e.g. deckey=X), the previous logic works. However, in the other cases I am getting some very strange numbers. If not deckey, produces the following result "1.000.000.000". Can you provide a solution?

GuiXT uses the DecimalSeparator in a "Set" statement both for interpretation of the input decimals and for formatting the output. This is why the result is not as you expected. To get it right, you can do the following:

// First, get the number without any decimal places

Set V[x] "&[reqtxt_wa](216-238)" * 10000 DecimalSeparator='.'

// Now do the formatting with 2 decimal places

if V[deckey=X]

Set V[x] "&V[x]" / 100 Decimals="2" DecimalSeparator="."

GroupSeparator=","

else

if V[deckey=Y]

Set V[x] "&V[x]" / 100 Decimals="2" DecimalSeparator=","

GroupSeparator=""

else

Set V[x] "&V[x]" / 100 Decimals="2" DecimalSeparator=","

GroupSeparator="."

endif

endif