the feature built in UIpath only remove the duplicates in the excel
but I wanted to extract the similar data “rcp_no” instead of removing it using ‘remove duplicate row’
how to get the duplicate row and write it into new excel?
DuplicateRowsDt = (From d In TestDt Group d By k=d(“rcp_no”).toString.Trim Into grp=Group Where grp.Count >1 Select grp.toList).SelectMany(Function (x) x).CopyToDatatable.AsEnumerable.GroupBy(Function(x) x(“rcp_no”).ToString.Trim).Select(Function(y) y.First).CopyToDataTable()
Ya sure… @terrylim11
From the above linq query, first you will get all the duplicate rows,
i,e. - (From d In TestDt Group d By k=d(“rcp_no”).toString.Trim Into grp=Group Where grp.Count >1 Select grp.toList).SelectMany(Function (x) x).CopyToDatatable.
Then I used this code to get unique among dupliacte rows :- .AsEnumerable.GroupBy(Function(x) x(“rcp_no”).ToString.Trim).Select(Function(y) y.First).CopyToDataTable().
Since their is no duplicate rows in “rcp_no” column because of that you where getting this error, check this updated workflow @terrylim11 Uipath_GetDuplicateRows.xaml (7.3 KB)
Can you send me the condition in the if activity @terrylim11 ??..
Whether the condition is like below code,
(From d In TestDt Group d By k=d(“rcp_no”).toString.Trim Into grp=Group Where grp.Count >1 Select grp.toList).SelectMany(Function (x) x).Count > 0
Ya change it to this below code, @terrylim11
(From d In TestDt Group d By k=d(“rcp_no”).toString.Trim Into grp=Group Where grp.Count >1 Select grp.toList).SelectMany(Function (x) x).ToArray().Count > 0
good job really appreciate
(From d In TestDt Group d By k=d(“rcp_no”).toString.Trim Into grp=Group Where grp.Count >1 Select grp.toList).SelectMany(Function (x) x).CopyToDatatable.AsEnumerable.GroupBy(Function(x) x(“rcp_no”).ToString.Trim).Select(Function(y) y.First).CopyToDataTable()