Create variable with double value

excel
uiautomation

#1

Hi Guys, I’m Brazilian, so my english is not good, i will try to explain my question.

Here in Brazil the number format for financial value is like “X.XXX,XX” … The comma character separates cents to our currency, so i can’t ignore these numbers, but when i declare the variables the system shows error “StringConverter cannot convert from System.Double”.

I guess the variable type is wrong, but i dont know what type i will use in this case.

Please somebody could try to explain how to work with double values?

Again, i’m sorry for my language mistakes.

Find attached an flowchart with the example of what i’m looking for.

approval.zip (8.2 KB)


#2

Check this topic

or to be exact:


#4

Example :- Value1 = $450.65
Value 2 = $540.54

Store the values as a string . then use convert.ToDouble(Value1) and let us know.

We have tries in our application once and its working fine


#5

Sorry Missed out a thing. Use regex to remove the $ symbol


#6

Men, i read the related post, i already try to use the replace function in many ways and the error continues.

I think I did not express myself well, I doesn’t want to convert the number in financial value, i need the variable to read de decimal value in excel plain, but i can’t ignore the decimal number after the comma, because i need the cents.

i.e.: I have in the excel file like 0.000,00 and i need the value outputed the same 0.000,00

So, to explaing better, i need a decimal variable that is what i’m not getting.


#7

Karthnick,

I guess the problem is that in Brazil we use comma to separate decimal number, we don’t use dot for this.

In the excel plain I do not have the $ character, just number separate by comma, and the system show me error when I try to read the value.

Thanks


#8

So you mean to say you need value after comma also (00.00,00) ? .


#9

Not exactly, I attached a example.

The value is a cost of my service, but I receive the plain with this field in decimal format and i want to upload this number in decimal format with comma.

The first dot is not necessary (0000,00)

Follow attached

approval.zip (8.2 KB)


#10

@henrialves
you need to use the locale for Brazilian Portuguese when you parse the numbers. Strip away the currency sign and then parse the String with the CultureInfo set to “pt-BR” and it will swap the commas and decimals according to the Brazilian locale rules. Check to make sure System.Globalization is in your imports.
Screenshot of it working in my studio: