I have 2 datagrids with 3 columns each
I need to find duplicates in both columns based on col 0 and 1. Col 3 contains a primary key
I need to match 2 duplicates ( or 3 etc) in each grid and clear
basicallt if there are 2 (or more) identical records in left grid see if there are 2 (or more) matching records in left grid. In order to match number of dupes found must match each other. So id 2 dupes found in left grid, it must match 2 dupes in right grid to clear
So far I have loaded two generic lists with grid data
I go thru each list and match 1 record to 1 record and save the primary key to a clear list which works fine
Then I use LINQ for each list like
doesn't seem to work. I am really new with LINQ and unsure if this appraoch is viable at allHTML Code:Dim dupDebit = From debitWord In d Select debitWord Order By debitWord.Description, debitWord.Amount Dim dupListDebit = From debitWord In dupDebit Group debitWord By GroupKey = New With {Key debitWord.Description, debitWord.Amount} Into g = Group Where (g.Count() > 1) Select New With {Key GroupKey, Key .Count = g.Count()} 'For Each group In dupListDebit ' Console.WriteLine("Description: {0} Amount: {1} Count: {2}", group.GroupKey.Description, group.GroupKey.Amount, group.Count) 'Next group ' ''credit counts Dim dupCredit = From creditWord In c Select creditWord Order By creditWord.Description, creditWord.Amount Dim dupListCredit = From creditWord In dupCredit Group creditWord By GroupKey = New With {Key creditWord.Description, creditWord.Amount} Into g = Group Where (g.Count() > 1) Select New With {Key GroupKey, Key .Count = g.Count()} this is where I am not sure or if this is any use at all,, I then tried to do a match like to clear dup itemsa from each that have same counts: Dim _ final = _ From dl In d _ Join cl In c On dl.Description Equals cl.Description And dl.Amount Equals cl.Amount final.Select(Function(item) New With {Key .Alpha = item.dl.Description, Key .Bravo = item.dl.Amount, _ Key .Charlie = item.cl.Description, Key .Delta = item.cl.Amount}).Distinct()


Reply With Quote
