Delete duplicates from DataTable using a lList of string as source

Hi all!

I’m facing a problems in deleting duplicates from a DataTable. I already tried deleting them using REMOVE DUPLICATES activity, from both Excel and DataTable activities but, for my problem, it did not worked. Here is a screenshot of my workflow:

The condicional verifies if the list ‘duplicatesList’ contains the value of the current row, and if it does, the row is added to another list, to be iterated later, removing from the original DataTable, but I can’t find a way to use this list with the data table.

willing to help provinding more info.


Try with this linq query to delete rows of a column if that column doesn’t have any of the values form the list variable

filteredDataTable = originalDataTable.AsEnumerable().Where(Function(row) yourList.Contains(row("ColumnName"))).CopyToDataTable()

Cheers @guilherme_melato

1 Like

Hi @guilherme_melato ,

Could you let us know if you would want to correct your existing approach or if you are open for other approaches as well ?

If open for other approaches, there are already many scenarios/posts here on removing duplicate rows available, Could you maybe check on them, One of them is below :

Let us know if you were able to perform the same operation or need help in modifying it.

dataTable.AsEnumerable().Where(Function(row) rowsToBeRemoved.Contains(row(“Apólice”).ToString)).CopyToDataTable()

Had to add the ‘ToString’ cause was returning that i can’t convert an object to string. Is it right?

1 Like

Basically that’s right
As we are comparing with list or array of string we are converting to string


it’s returning this error…
May be something related to the type of the strings?