Decimal places converting from text to decimal

Hi,

I’m working with XMLPorts, and I receive a number in text format (i.e. “573,08”), I used EVALUATE() to convert from TEXT to DECIMAL, so the sintax is:

EVALUATE( decimalvar, textnumbervar ).

Following this sample, it returns 57,308… Why it’s taking 3 decimal places instead taking 3 ?

There is another way to convert this text values to decimal?

Tanks in advance

Check your local regional settings coma char might be setup to be thousand separator and not decimal separator. In XML files dot is usually decimal separator.
If you don’t want to change your regional settings when using EVALUTE function, decimal it’s better to use EVALUATE(var , string , 9). That way you are forcing to evaluate in XML format.

[Moved thread from Membership Questions to Developers Forum]

Hi Nuno Maia,

Thanks for your quick response…

Two things:

a) I can not change the regional settings, here in our countries we use “,” for decimals and “.” for thousands.

b) I tried using EVALUATE( decvar, textvar, 9 ), but the same problem happened.

Any other ideas?

I’m trying to configure the XML origin to receive a dot, intead than a comma.

Maybe in 2 steps ¿?:

  • EVALUATE(decimalvar, textnumbervar)
  • decimalvar := round(decimalvar, “0.01”)

According to arielmusumeci post problem isn’t only in decimal places and rounding. If you have in text 573,08 and is converted to 57,308 problem isn’t in rounding but in some kind of format.

how to remove coma in decimal?

if 1,500.7800

then become 1500.7800

my code → FORMAT(ROUND(TotalAmt,0.0001,’>’),0,’<Decimals,5>’)

IF You use this code It will work

FORMAT(ROUND(TotalAmt,0.01,’=’),0,’’)

…Shiv Shankar Jaiswal From GITL INDIA

Hi all, and thanks for your answers.

Finally I used the FORMAT( var, n, ) function and it did the work.