How to filter data table?

HI community,

I want to verify whether Column “Name” has values “India and Australia” or not.

image

Please help me how to filter.
Thanks in Advance :slight_smile:

Hi @Vaishnav_Tej ,

Have you tried using the Filter Datatable activity with Or Condition ?

{"INDIA", "AUSTRALIA"}.Intersect(YourDTVar.AsEnumerable().Select(Function (x) x("Name").toString.ToUpper().Trim)).Count = 2

If I give OR condition that’s not the correct verification. Because I need to verify for both the rows irrespective of their row position

What is this? Where to place this query?

@Vaishnav_Tej

list=[“India”,“Australia”]

boolutput = SourceDT.AsEnumerable.any(Function(row) dtList.Contains(row(“Col 2”).ToString))

[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum

Assign Activity:
myCHK | Boolean =
… Statement from above

@Vaishnav_Tej

arr_values=dt1.AsEnumerable.Select(Function(r) r("ColumnNmae).ToString).ToArray

are you can try this

I’m using test automation framework.
So to verify I’m using Verify Expression activity.
But before that I need to add if condition whether that column has those 2 values or not.

I already have a datatable. So I think no need to build data table

Any other alternative simple solution. Because I have 6 more columns which i need to verify in a similar way.

@Vaishnav_Tej

for sample i have done through the build datatable activity

you can use below

booloutput=dt1.AsEnumerable.any(Function(row) arr_values.Contains(row(0).ToString))

So for every column I verify I need to create 2 assign activties ? Array and boolean ?

@Vaishnav_Tej

yes you need to create