How to give a command in LINQ the Column is null or empty

hello, UiPath family,
I want to check the column is null or empty using Linq
like that column is null we have to give a notification how to give a command in LINQ

Thanks
Chethan P

Hi,

How about the following condition?

dt.AsEnumerable.All(Function(r) r("target") is Nothing OrElse String.IsNullOrEmpty(r("target").ToString))

Regards,

3 Likes

how can we use this if we use to assign it in a Boolean variable and in if we use or what?

here I need to read the excel data and excel sheets like sheet1 and sheet2 and sheet3
we have different data and the column is the same hear we have column it has Status if the status is null means the column is empty we have read that particular row and make some activity in that details and send details to Manager and make status column is success

Hi @copy_writes,

to my understanding for your scenario there will be more than one blank value in status column and for each blank value you need to send notification ,you can use like this.

for each row in dt_sample
if (row(“Status”).ToString =""
send notification here.

Linq is not required for this scenario.

1 Like

ya i did that one i just try to implement LINQ because it was much faster than String.isnullorEmpty(row(“status”).tostring)

Thanks
Chethan P

Hi,

The above expression returns boolean value. So we can set it to boolean variable using Assign activity as the following or set it to condition property of If activity directly.

  booleanValue = dt.AsEnumerable.All(Function(r) r("target") is Nothing OrElse String.IsNullOrEmpty(r("target").ToString))

Regards,

2 Likes