Cannot convert generic value to system.double

studio

#1

Hi, I’m having an issue now where I have a read cell activity which would return a generic value. And later I’ve used assign
double = cdbl (generic value)

I’ve recently shifted the project from a development environment to production environment and only started receiving this error in the production environment.

May I ask what could have possibly caused this?
As I know having a generic value as output for a read cell activity should be safe.
The value of the cell may not contain decimals, sometimes it does, if it doesn’t, will it cause cdbl to not work?

I’m thinking of converting adding an assign
string = genericvalue.tostring
double = cdbl(string)

will this solve the issue?


#2

Hi @inyourgravity,

Try using invoke code activity and have the below coding in it.

    If Double.TryParse(value, number) Then
        outputVal = number
    Else
        outputVal = 0
    End If 

and add the following as the input and output parameters for that function.

value As String --> Input Param - Pass your “inputGenericValue”
number As Double --> Input Param
outputVal As Double --> Output Param