There is a scenario , in which column1 has duplicate value.
Need to remove the completed DataRow in against the duplicate value.
Refer the image->
1 Like
@Vaibhav_Rajpoot_17 , Try this
- Read the Excel file and store a variable as"ReadDataTable"
- Assign activity - NewDataTable=ReadDataTable.Defaultview.ToTable(True, “Column1”,“Column2”,“Column3”).
Note: NewDataTable is - Write range, check the header, Pass the NewDataTable as a input.
@Vaibhav_Rajpoot_17 , also can use Remove Duplicate Excel activity
How about this expression?
(From p in DT.Select() where( From q in DT.Select() where q("Column1").Equals(p("Column1")) Select q).ToArray.Count=1 Select p).ToArray.CopyToDataTable()
Regards
Gokul
Hey!
Try this
DtNew=Dt.DefaultView.ToTable(True)
The above expression will remove the duplicates in entire table
If we wants to remove the duplicate records in particular column we can try like this
DtNew=Dt.DefaultView.ToTable(True,"ColumnName1","ColumnName2")
Regards,
NaNi
Please try this approach
(
From row In dt_Data.AsEnumerable()
Group row By k=row("Column1")
Into grp=Group
Select grp(0)
).CopyToDataTable
Xaml for reference
1 Like
how about this lets try
dt.AsEnumerable().GroupBy(Function(x) x(“ColName”).ToString)[Select](Funtion(y) y.First()).CopyToDataTable()
dt = dt.AsEnumerable.GroupBy(Function(x) x(“Column1”)).Select(Function(g) g.First()).CopyToDataTable
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.