Hi, does anyone know how to get only the unique value in Datatable. For example, if the column School contains five rows
AA School
BB School
CC School
AA School
CC School
The datatable should return only BB School.
Hi @Dalaboomba
Can you try the below
DT.AsEnumerable().GroupBy(Function(row) row("School").ToString()).Where(Function(g) g.Count() = 1).Select(Function(g) g.Key).FirstOrDefault()
Regards,
Assign Activity:
dtDeDup =
(From d in yourDTVar.AsEnumerable
Group d by k=d("SchoolColName").toString.Trim into grp=Group
Where grp.Count=1
Select r=grpFirst()).CopyToDataTable
Handling empty result:
[FirstAid] Handling of The source contains no DataRows exception - News / Tutorials - UiPath Community Forum
1 Like
It works perfect! Thank you so much!
1 Like
Use DT.defaultview.table(true,“ColumnName”)
Thank you!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
