I need to filter the data table,
Input data have “Account id” “Division” “Customer name” “Received date”
I want to filter the data table for the below condition.
Condition: Received date we need to check first is there any duplicate are present are not if the received date is duplicate we need to check “Account id” or “Division” or “Customer name” or “Received date” any one of the column contain duplicate value then we need to remove from that.
filteredDataTable = (From row In inputDataTable.AsEnumerable()
Group row By key = New With {
.ReceivedDate = row.Field(Of DateTime)("Received date")
} Into Group
Where Group.Count() = 1
Select Group.First()).CopyToDataTable()
(From row In InputDT.AsEnumerable()
Group row By key = New With {Key .ReceivedDate = row.Field(Of String)("Received Date")}
Into grp = Group
Where grp.Count() = 1
Select grp.FirstOrDefault()).CopyToDataTable()
FilterDatatable=(From row In Dt.AsEnumerable()
Group row By key = row.Field(Of String)("Your column name") Into Group
Let firstRow = Group.First()
Select firstRow).CopyToDataTable()
row.Field(Of String)(“Your column name”) give the datatype of the column in your excel if it is string give string or it is datetime give datetime