Micro Focus QTP (UFT) Forums
Rounding with "." decimals - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Rounding with "." decimals (/Thread-Rounding-with-decimals)



Rounding with "." decimals - pjeigenn - 07-26-2010

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


RE: Rounding with "." decimals - sasmitakumari - 07-27-2010

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


RE: Rounding with "." decimals - Saket - 07-27-2010

Round works correctly for both "," and "." depending on the regional setting of the system. check your regional setting at Control panel.


RE: Rounding with "." decimals - sasmitakumari - 07-27-2010

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


RE: Rounding with "." decimals - Saket - 07-27-2010

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.


RE: Rounding with "." decimals - pjeigenn - 07-27-2010

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