Micro Focus QTP (UFT) Forums

Full Version: Rounding with "." decimals
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I notice that round only works with ",", if the decimal part is separated with "." it doesn´t work.

Round(100.0)=1000

Is there any function that works with both decimal systems? And a function that works with "."?

Thanks
Hi pjeigenn,
I did not understand your question?
Rounding decimal should work, and the syntax is like this:
Round(expression[, numdecimalplaces])
Ex:
tt=Round(100.456) 'tt contains now 100
tt=Round(100.456, 2) 'tt contains now 100.46
Round works correctly for both "," and "." depending on the regional setting of the system. check your regional setting at Control panel.
Hi Saket,
I have changed the regional setting to Spanish, but it did not work for me, how should be the syntax for that?
I have tried with following, it gives me syntax error.
tt=Round(123456789,1234) 'here ',' works as decimal
msgbox tt
as I can remeber, there are some other settings too. I will see if I can get that.
may be pjeigenn can help us, to get it quickly.
I am looking for the settings you said, I have windows 7.
With "," it works properly, for "." it doesn´t.
If I manage to solve the problem i will post the solution...
----------------------------------------------------------
I am looking my problem, and it is weird.
round(100.0)=100 -> It works properly

Code:
v_MontoAdhesion=Browser("Browser").Page("Page_10").WebTable("Empresa").GetCellData(filas-2,4) =" 100.0"
v_MontoAdhesion=trim(Browser("Browser").Page("Page_10").WebTable("Empresa").GetCellData(filas-2,4))= "100.0"
round(v_MontoAdhesion)=1000 -> ¿?
int(v_MontoAdhesion)=1000
round(int(v_MontoAdhesion))=1000

Don´t know what´s going on