Filter by most reliable datasource using queries in Linq

shirleybison

New Member
I am fairly new to using Linq which is turning out a bit tricky for me on filtering the best datasource from a c# datatable. I need to perform the following filtering to a datatable. The background behind the data is that it is a set of records which contain independent redundancies from different datasources for the purpose of failsafe. In case one datasource had become corrupted at some point, a secondary or third datasource would become the primary source for that event thread. Original Data (for example):signintable:\[code\]source First Lastd1 John Smithd1 John Smithd3 John Smithd1 Jane Doed2 Jane Doed3 Richard Milesd3 Richard Milesd1 Richard Miles\[/code\]I would like to add two columns to this: a count of unique members of groups by(firstname, lastname and datasource), and a uniqueRecordGroupnumber based on distinct group (firstname, lastname, datasource) but ordered by whichever datasource for that particular first name last name has the most records, to the least.\[code\]source First Last Count UniqueRecordGroupd1 John Smith 2 1d1 John Smith 2 1d3 John Smith 1 2d1 Jane Doe 1 1d2 Jane Doe 1 2d3 Richard Miles 2 1d3 Richard Miles 2 1d1 Richard Miles 1 2\[/code\]Then I would finally filter out only the primary (unique record group 1) in order to eliminate the redundancies/ less reliable datasource for that particular record.\[code\]source First Last Count UniqueRecordGroupd1 John Smith 2 1d1 John Smith 2 1d1 Jane Doe 1 1d3 Richard Miles 2 1d3 Richard Miles 2 1\[/code\]How are the above steps accomplished using Linq on a datatable (for example datatable signintable)?Thank you.
 
Back
Top