Null value is showing as not null

Hi,

I am trying validate if some of the elements are Nothing. If any of those four values is nothing, then it should turn “True” and move to If condition. But somehow its going to else.

This was completely working fine until yesterady. How come this can fail today?

I have the attached statelent in the “If” condition.

Hi,

I think the content may be not null but empty string.
Can you try the following expression?

in_TransactionItem.SpecificContent("Name") is Nothing OrElse String.IsNullOrEmpty(in_TransactionItem.SpecificContent("Name").ToString) OrElse
in_TransactionItem.SpecificContent("Age") is Nothing OrElse String.IsNullOrEmpty(in_TransactionItem.SpecificContent("Age").ToString) OrElse
in_TransactionItem.SpecificContent("Item Type") is Nothing OrElse String.IsNullOrEmpty(in_TransactionItem.SpecificContent("Item Type").ToString) OrElse
in_TransactionItem.SpecificContent("Dept") is Nothing OrElse String.IsNullOrEmpty(in_TransactionItem.SpecificContent("Dept").ToString)

Regards,

1 Like

@Krithi1,

Also add logic to trim whitespace like this.

in_TransactionItem.SpecificContent("Name") is Nothing OrElse String.IsNullOrEmpty(in_TransactionItem.SpecificContent("Name").ToString.Trim) OrElse
in_TransactionItem.SpecificContent("Age") is Nothing OrElse String.IsNullOrEmpty(in_TransactionItem.SpecificContent("Age").ToString.Trim) OrElse
in_TransactionItem.SpecificContent("Item Type") is Nothing OrElse String.IsNullOrEmpty(in_TransactionItem.SpecificContent("Item Type").ToString.Trim) OrElse
in_TransactionItem.SpecificContent("Dept") is Nothing OrElse String.IsNullOrEmpty(in_TransactionItem.SpecificContent("Dept").ToString.Trim)
1 Like