Filter Data Table of two city names

hi,
i have one excel column names like User,City. i want filter city names contains( London, New York) to copy another excel.
i want to extract above 2 city names another sheet .how can i filter both city names ?

You can try similar to this -

str_filter = “City IN (‘London’,‘New York’)”
DataTable.Select(str_filter);

or

Use the ‘Filter Data Table’ activity -
using row filter – you can filter the values.
Column name as ‘City’ contains ‘London’ or Operation
Column name as ‘City’ contains ‘New York’

or

dtFilter.AsEnumerable.Where(Function® City.Contains(r.Field(Of String)(“London”))).CopyToDataTable

Hi
Hope these steps would help you resolve this
—use a excel application scope and pass the file path of excel file as input and inside the scope use a READ RANGE activity and get the output variable of type datatable named dt
—now use a ASSIGN activity like this
dt = dt.AsEnumerable().Where(Function(a) a.Field(of string)(“yourcolumnname”).ToString.Contains(“London”) OR a.Field(of string)(“yourcolumnname”).ToString.Contains(“New York”)).CopyToDatatable()

Now use a WRITE RANGE activity and pass the input dt variable with Add Headers option enabled

Cheers @Anand_Designer

1 Like

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