Remove Duplicate Values

How to remove duplicate values, considering a particular column and write it to other sheet.

give a try on following:

assign activity
LHS: dtCleansed
RHS:

(From d in YourDataTableVar.AsEnumerable
Group d by k=d(YourColBNameOrIndex).toString.trim into grp=Group
Where grp = 1
Select g =grp.First()).CopyToDataTable

it is removing all duplicates

in case of we want to keep also the first from the duplicates or others we can modify as well

Hi @nidhi.kowalli

Use the LINQ below to get the Unique values from the column!

dataTable = dataTable.AsEnumerable()
.GroupBy(Function(i) i.Field(Of String)(“columnWithDuplic”))
.Select(Function(g) g.First)
.CopyToDataTable

Regards

M getting error as " End of Expression is Expected"

Hi @nidhi.kowalli

use assign activity create a datatable variable! LHS

RHS: YourReadDt.AsEnumerable.GroupBy(Function(i) (i)(ofString)(“ColumnWithDuplicate”).Select(Function(g) g.First).CopyTodatatable

refer to the xaml below @nidhi.kowalli

Main.xaml (7.6 KB)

Regards

find starter help here:
FindDupsUniquesFirstFromGroup_By1Col.xaml (9.3 KB)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.