Hello friends,
I’m trying to convert a string to a double inside a loop (datatable from Excel file):
but incountered following error: string format not correct
Hello friends,
I’m trying to convert a string to a double inside a loop (datatable from Excel file):
but incountered following error: string format not correct
Just debug the bot and when the exectution is failling do following:
In general, invalid values e.g. letters, spaces etc are creating this exception. One thing you can try is to trim the value before converting
Hi,
Convert.todouble(row(“”))
convert this way
Converting an empty string value is invalid and do fail
Same as described above you can check the details within immediate panel
Hi
Please check is there any other special characters in the value or a space or a blank value
Use a if condition inside the loop like this with a IF activity
Not String.IsNullOrEmpty(row(“yourcolumnname”).ToString.Trim)
If condition true it will go to THEN part where you will get all the values converted to double except empty values
Cheers @abdel
Add if condition in the assign. if the string is empty then it will not convert this value.
If(string.isnullorEmpty(“yourvariable”),“”,convert.todouble(yourvariable))
Let me write it for you… 2mins
What is the datatype of Sum_gestioniare_h variable?
if it is double then instead of “”-> change it to 0
like if string is empty then currentRow(“MontantDT”) value would be 0.
also use double conversion like this → convert.ToDouble()
it is a doubl
yes then what would be the value if currentRow(“MontantDT”) is empty? whatever value you want you can write it instead of “”
.