Filter table by 2 Columns

Hi,
I have to filter datatable by 2 columns (Column1=“2” and Column29=“ODK”) and then remove them from table but activity filter data table is not working at all, it is not removing those rows.

Sometimes there are unforseen blanks surrounding the values in Excel, which can disturb the filter datatable result.

give a try on following:

Use an assign activity:
LeftSide: dtFiltered | DataType: DataTable
Right side:

(From d in YourDataTable.AsEnumerable
Where Not d("Column1").toString.Trim.Equals("2") and d("Column29").toString.Trim.Equals("ODK")
Select d).CopyToDatatable

in case of an empty filter result is also to expect we can handle this defensive:

Also have a look here:

1 Like

Hi @markosc !
Interesting, would you mind sharing:

  • either your workflow + excel file
  • or share a screenshot of your filter datatable activity + excel file

→ We need to check together that your excel file has only “2” and is not “2 " or " 2”, same goes with “ODK” if it’s not " ODK" or "ODK "
→ Depending on what contains your excel maybe we will end up using Contains instead of = as operator between your conditions
→ we need to check that there is “And” between your conditions
→ we need to check the input/output DT provided

Hi there,

Please show the conditions you’ve added in the filter datatable activity. It should work for the problem you’re trying to solve

Assign: The source contains no DataRows. it is giving me this error

image

had you implemented the pattern, for handling empty filter result? If not please do it. CopyToDataTable throws this error in case of no Datarows are sent to it

Thank you for the screenshot of the filter wizard @markosc
Now we need to have a glance at your data, so your excel file, especially the headers and the content

Adding to what others have said:
Datatabe columns start at index 0. Just FYI in case you accidentally missed it.
You can also try without the string quotes

Wrote the wrong index (29 instead of 28).

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