Heei guys! I get an error when using un assign activity

The error says : Object cannot be cast from DBNull to other types.
How do I salve this?
This is the value I save in the assign activity: Convert.ToDouble(RowDT(“Net Value”))

you can try mentioning like this
if(String.IsNullOrEmpty(RowDT(“Net Value”).ToString.Trim), 0, Convert.ToDouble(RowDT(“Net Value”).ToString.Trim))

Cheers @maria-iulia.zdrenghea

I don’t use it in an if activity

this is you can mention in VALUE property of a ASSIGN activity
this is not for IF condition @maria-iulia.zdrenghea

Hi @maria-iulia.zdrenghea ,

Maybe the below could also be an Alternate :

netVaueVar = If(RowDT("Net Value").ToString.IsNumeric,CDbl(RowDT("Net Value").ToString),0)

Here, we are assuming that 0 could be assigned to the variable when the Value present in the row is either Empty or Null or Non-Numeric

But I need the value to remain double

variable which is receiving will remain as DOUBLE type only
we are here validating whether the row has value in it or not
if it has then it will convert if not it will give 0 as value which is also a double value