Use OrElse instead of Or, so that the second condition is not evaluated. Also, you might need to add the null check to the Else If part due to this issue: Activities - Else If
@Yoichi
Thanks for the reply, are you suggesting I change my “first condition” dt_preRegisteredPatIds is Nothing orelse dt_preRegisteredPatIds.Rows.Count = 0 orelse not dt_preRegisteredPatIds.Rows.Count.Equals(expectedNumOfAccts)
This is where I was checking for a null DT and if the row count is not equal to some predefined expected value
Assign DTHaveRows = IF(DT.RowCount>1,True,False) (DTHaveRows Var Type= Boolean)
If you Data Table has Values then it will return True otherwise it will return False
IF DT is NULL you can check using IF Condition DT Is Nothing Or Else DT.Rows.Count = 0
Hi @Nawazish_Ahmad
Better if you delete your advice.
The question was how to handle Null DT. Your proposal will not address it → if DT is Null then DT.RowCount will throw exception.
Cheers
P.S. Even after the update your advice is not any better The correct answer was already given by @Yoichi
@Yoichi Thanks for the input, but I’m still not out the woods yet because I’m still getting the exception.
I output the content of the second DT ( see screenshots) and I’m sure that it has not been populated.
As already indicated by @efelantti use AndAlso instead on And
The error is generated by the second part of the condition which is in case of using simple And also evaluated.