Hi Team,
I want to filter rows using LINQ query …
I have table like below
I want to filter only rows which is having “HSM” value in accounts column… I tried filter data table activity but it is taking too much time and failing sometime since I have lakhs of records in my excel.
So want to try using LINQ query and used below LINQ query shared by @J0ska @kumar.varun2 in another post .
dt_Data=dt_Data.AsEnumerable().Where(Function (row) row(“Accounts”).ToString.ToUpper.Trim.Equals(“HSM”)).CopyToDataTable
Dt.AsEnumerable.Where(Function(r) r.Item(“Accounts”).ToString.Equals(“HSM”)).CopyToDataTable
Above two LINQ queries is working when there is having “HSM” value in accounts column … But sometimes I am not getting “HSM” value in accounts column and BOT is failing in suck scenarios …
I want LINQ query which works in both the scenarios …
Scenario 1 : It Should return the rows which is having HSM value in accounts column when there is HSM value in accounts column
Scenario 2 : It Should return empty table when there is no HSM value in accounts column
@J0ska , @kumar.varun2 Could you please help me
Thanks,
Naresh