Mr.H
1
Hi Everyone.
I want to remove duplicate row with LinQ in datatable.
The datatable as below picture and attached file. I want remove the duplicate rows if the value at “status” column is blank…
The Input Table:
The Output Table:
Thanks in advance!
Book1.xlsx (8.3 KB)
Yoichi
(Yoichi)
2
Hi,
Can you try the following expression?
result = dt.AsEnumerable.Where(Function(r) r("status") isnot Nothing AndAlso (not String.IsNullOrEmpty(r("status").ToString))).CopyToDataTable
Or
Probably, you can also use FilterDataTable activity to achieve it.
Regards,
1 Like
Jobin_Joy
(Jobin Joy)
3
Hi @Mr.H
You can make use of the Filter Data Table as in the below inline screenshot.
Hope this will be helpful. Thank you.
1 Like
Mr.H
4
Hi Bro.
No, i want to delete the duplicate rows in datatable.
In the input datatable, i have 3 duplicate rows… but it only remove the duplicate row which is null at “status” column.
In the actual data, it has many row null or not null at “status” column.
Yoichi
(Yoichi)
6
Hi,
I had misunderstanding your requirement.
How about the following expression?
result = dt.AsEnumerable.GroupBy(Function(r) r("item").ToString).SelectMany(Function(g) g.Where(Function(r) r("status") isnot Nothing AndAlso (not String.IsNullOrEmpty(r("status").ToString)))).CopyToDataTable
Regards,
1 Like
Mr.H
7
Thanks you very much Bro!
1 Like
system
(system)
Closed
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.