Remove all duplicates rows based on a column

@Yugal_Raju,

Use this code in invoke code activity.

' Step 1: Identify the duplicate materials
Dim duplicateMaterials = (From row In dtInput.AsEnumerable()
                          Group row By material = row("Material").ToString.Trim Into grp = Group
                          Where grp.Count > 1
                          Select material).ToList()

' Step 2: Filter the DataTable and remove all rows with duplicate materials
Dim dtResult As DataTable = dtInput.AsEnumerable() _
    .Where(Function(row) Not duplicateMaterials.Contains(row("Material").ToString.Trim)) _
    .CopyToDataTable()

' Optional: Handle case when dtResult might be empty
If Not dtResult.Any() Then
    dtResult = dtInput.Clone() ' Returns an empty DataTable with the same structure
End If

LLM helped me to write this