Convert Generic to Double

Hi All,

I am getting generic value from screen scraping like (8.9 , 95.85 , 100.234) etc which I am storing in a variable ‘FinalTaxRate’ .
Now I need to do some computation on the values like add all such values that I am getting from screen scraping , so for that I have defined a variable “outputDouble” which is of type double .
Now when I try to convert the generic value to double I am getting the error saying the generic cannot be converted to double.
I tried below two approach but both did not help me .
Uploading the project zip file as wellCalculus.zip (36.4 KB)

  • cDbl(FinalTaxRate.ToString)
  • image

Can you all please suggest any workaround.

Thanks

Ctype(variable, double)

try this @Chetan1809

1 Like

@Chetan1809
I have my doubts if XXX.TryParse is working reliable as it has to handle the out var
Method Signature: TryParse (string s, out double result)

we stopped to use it in our implementations and do conversion similar to @HareeshMR or with
Convert.ToX…, or DirectCast

Still not working and giving same error

Can you please elaborate. I am not very clear… Ctype(variable,double) is also giving the same error…

Can you try in an assign acitvity (instead of invoke code)
To: outputDouble
Value: CType(FinalTaxRate.ToString, double)

Still getting the error

image

Yeah, got it

While passing the value to the expression CType(FinalTaxRate.tostring, Double) … Send the variable as FinalTaxRate.tostring.Trim

I am not sure what is the issue , I have created one test workflow and used … Double.Parse(FinaltaxRate.ToString) and it worked fine… I am not sure why it is not working now.
I am attaching my project. Please let me know if you find the issue.

thanks
Calculus.zip (36.4 KB)

Have you tried this? I hope as it is a string, it has some unwanted space in the end. So, try this @Chetan1809

Post the error whatever you are getting when you run the above attached workflow

I am still getting below error.