Linq querry for getting blank cell and system exception rows in excel sheet

Hi Guys,

I wanted to filter blank rows and system exception rows(failed) in ‘Bot Status’ column in an excel.

When I run the bot it has to pick only these two status transactions for the execution.

Can i know how to get a LINQ query for this instead of using filter data table.
Below is the screenshot for the reference.

Thanks in advance!!

1 Like

Hi @vinutha1 ,

Will this solve your query?
Dt.AsEnumerable.Where(Function(w) Not w(“BOT Status”).ToString.Trim.Equals(“Success”)).CopyToDataTable

Kind Regards,
Ashwin A.K

1 Like

Hi

Hope the. Below expression would help you resolve this

dt = dt.AsEnmerable().Where(Function(a) String.IsNullOrEmpty(a.Field(of String)(“BOT Status”).ToString.Trim) OR a.Field(of String)(“BOT Status”).ToString.Contains(“Failed”)).CopyToDatatable()

Cheers @vinutha1

1 Like

Hi,

Can you try the following?

dt.AsEnumerable.Where(Function(r) r("BOT Status").ToString.StartsWith("Failed") OrElse String.IsNullOrWhiteSpace(r("BOT Status").ToString)).CopyToDataTable()

Regards,

@Yoichi

It works…Thank you so much

1 Like

Thank you @Palaniyappan

1 Like

Thank you @ashwin.ashok

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.