Operations with different types of variables

Hi Guys,

I have a slight problem with math operation with variables. I have tried the several methods in order to multiply two variables but it does not work.
var1 = 1.452,31 is a string variable and I put activity writeline and it shows 1.452,31
var2 = 0.01 and I have declare it as a double (System.Double) since it is not integer.
I have tried several things (parse, convert to double, CDbl…) with assigning activities but it will not assign thorough direct assigning (to third variable) or it does not recognize the first value (variable) as double number (real number) even if converted to double.

Most probably I will always need to get the real number as var3 (for example: 14,5231)

Can some help?

It’s not being recognized as a double because to the computer it isn’t a valid double.
To correctly parse your double it needs to be in the format 1,452.31. To do this you can do:
var1 = var1.Replace(".","").Replace(",",".")

This removes the period and converts the comma to a period. The robot will then parse this as a double.

1 Like

It helped me, thank you very much for such a promt answer!

Best regards!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.