Check both datatable is null and rows count in single if condition

Hi Everyone,

I have transactionData in RE framework which is null in some conditions and the condition i have to new transaction is Not(TransactionNumber = TransactionData.rows.count)

which is giving me visualbasicValue object reference not set to an object

I think bcoz transactionData is null it is throwing this error , if i use “transactionData isNot nothing and Not(TransactionNumber = TransactionData.rows.count”

Still it throws same error.

Thanks in advance

Hi @kavya.s16 ,

If you want to check if the TransactionData variable is null or empty, then could you give this a try?

IsNothing(TransactionData) OrElse TransactionData.RowCount.Equals(0)

Kind Regards,
Ashwin A.K

Is it like
IsNothing(TransactionData) OrElse TransactionData.RowCount.Equals(0) and Not(TransactionNumber = TransactionData.rows.count)
@ashwin.ashok

Hi @kavya.s16 ,

We could avoid this error by initialising the Datatable as a Default Value like below :

new Datatable

In this case, the Datatable will have 0 row count, if not populated.

Hi @kavya.s16 ,

If you are trying to check if the TransactionData is empty, then this alone will suffice, but if you want the last condition as well, then go ahead and use this →

IsNothing(TransactionData) OrElse TransactionData.RowCount.Equals(0) OrElse Not TransactionNumber.Equals(TransactionData.RowCount)

I am curious, could you please tell me why you are checking if the transaction number is equal to the TransactionData variable row count?

Kind Regards,
Ashwin A.K