Filter datatable by list

Hi everyone. I am trying to filter a datatable by a dynamic list stored in Excel. My example below shows a datatable where I want to remove the companies in the list. In the end I want a datatable without the companies in the list (in this case 17, 18 and 21) but I don’t want to hardcode these company numbers as they may change/add/delete in the future.

1 Like

Hi welcome to the community!
You can use Filter Data Table activity inside a loop of companies to remove array varible you create in your project.

1 Like

My removecompanies variable should be set up as a datatable or an array of Int32 (they are numbers)?

If you want to read them from the excel like in the screenshot, you can use read range (maybe leave this in a separate sheet).

The list is stored in a separate Excel spreadsheet and I used read range to get the removecompanies variable. How did I fix the error message above?

use for each row activity instead.

I tried this but the rows that should be removed are still there. I’m not sure what to put in value.

use row(0)

It didn’t work. Company 17 should be removed and it’s still there.

but you are checking in your excel for the filter result? are you writing the range back to the excel?

Yes, I am writing it back into Excel.


First thing you will want in your filter activity, the data table in and out must be the same, and if the condition isnt working, then change he value to Cint(row(0)).

Still didn’t work

My removecompanies datatable. I’m so confused!

then you will need to inspect using the debugger for the values coming from the row(0).

Ok thank you for your help!