Diff of 2 datatables
Diff of 2 datatables
hpegmslicensemgmt
Posts: 23Questions: 8Answers: 0
in General
Dear all,
Is there a clever way to get the difference between 2 DataTables ?
2 Tables with the same structure and similar content where Table A can have different entires of Table B ...
Best regards,
David
Answers
You can use
rows().data()
, possibly withtoArray()
, to get all the data in the Datatable. Use a loop to iterate the both sets of data to compare for differences.Kevin
Any sorting or searching that is applied differently between the two tables might affect the order the row data is traversed. See the
selector-modifier
docs to choose the appropriate options for your solution.Kevin
Right! Here is something from my own coding sorting the data so that that they can be compared and eventually diffed.