I want to remove Duplicate Id rows But condition is that in duplicate record R1 column value is empty only remove that rows


Hi @Gaurav_Gore
You can try LinQ

There are different techniques to group data:

  • dtData.DefaultView…, Filter DataTable, Process Group Members
  • LINQ
  • Dictionary population

Have a look here for learnings:

For a LINQ approach we can do:

Assign Activity:
dtResult =

(From d In dtData.AsEnumerable()
Group d By k=d("ID").toString().Trim() Into grp = Group
Let chk = grp.Count = 1
Let grp2 = grp.Where(Function (x) Not String.IsNullOrEmpty(x("R1").toString().Trim() ))
Let grpF = If(chk, grp, grp2)
From g In grpF
Select r = g).CopyToDataTable()

There is one possible scenario, which is not covered within your requirement description:

  • there is a group with more then 1 group members, but all group members R1 column value is empty

If above is to expect the LINQ requires some adaptions