I have 2 datatable, Datatable 1, has more rows than datatable 2, I want the data from datatable 2 is inserted into datatable 1 based on variance of minutes.
Okay so I have 2 datatables that consists of Destination, Minutes, Rate and Amount. What I am trying to do is to match the lowest difference in minutes from DT2 into DT1 and the country from both datatable needs to be same. But, we only have 3 datarows from DT2, so the number of rows need to be entered into DT1 also 3 datarows.
lets group dt2 data on the Destinations
Iterate over the groups
lets create some immediate helper stacks with the information of row indes and Minutes as double
as long we do have items on the stacks
find the closest match (done with an Match.Abs(d1Min-d2Min for getting the absolute diferrence)
Update the datarow from d1 with an modified ItemArray
remove found items from the Stacks