Isnothing(datarows) not working

Hi There,

Am encountering a problem while using the isnothing(datarow) in an IF statement.

The If statement is by default executing the ELSE branch irrespective of the result of the condition.

Please help resolve this!

Best,
Satin

Hi there @satinrr,
IsNothing will only evaluate as True in the event the variable is not initialised (null).

If the value is initialised, but contains no data (for example), you will need to add a subsequent condition.

From the perspective of a DataTable, you could use:
If (IsNothing(dtExample) = True ORELSE dtExample.rows.count < 1) Then

  • Throw

End If

The above will determine whether the DataTable is initialised and if so, whether it contains any rows.

Thanks,
Josh

2 Likes

Thank you for the quick response Josh @Mr_JDavey .

I am trying to use isnothing for datarows and not datatables. I apologize for not correcting the subject line.

Best,
Satin

If it’s for DataRows, check if this topic helps: