Skip to main content
Question

compare xml files

  • July 5, 2017
  • 0 replies
  • 71 views

Hi 
I have two xml files from 2 QuickBase Tables. both are similarly structured. They have 2 key attributes (PatiendId, Transaction Date). I need to develop a efficient mechanism to compare the two xml objects and identify how many patientid and transaction from table 1 exist in table 2. I am conversant with jquery and javascript and can run this in quickbase. I can do it by iterative method (like read from one xmls and then iterate other to find duplicates but i am looking for a efficient method) but i feel xml will have some better mechanism to give me the duplicates ?
Any help would be appreciated.

thanks & regards
dinesh
This topic has been closed for replies.

  • Registered
  • July 5, 2017
You can make the job a little easier by using API_GenResultsTable&jsa=1 to return arrays instead of XML. The compare the two responses using Underscore's difference() method like this:

var url1 = "https://login.quickbase.com/db/6ewwzuuj?act=API_GenResultsTable&qid=6&clist=3&jsa=1"; var url2 = "https://login.quickbase.com/db/6ewwzuuj?act=API_GenResultsTable&qid=7&clist=3&jsa=1";  $.getScript(url1)   .then(function() {     var data1 = qdb_data;      $.getScript(url2)       .then(function() {         var data2 = qdb_data;         console.table(_.difference(data1, data2));       });    });
This example can be executed from the console of the Formula Functions Reference table and returns the rids of those records in the first query but not the second:

Formula Functions Reference Home
https://login.quickbase.com/db/6ewwzuuj?a=td

You can further modify the reporting logic to identify those specific records with specific combinations of [PatiendId], field values that you are interested in seeing in the report.

See also Underscore's union() and intersection() methods.

If script writing isn't your forte, you could try a tool like kdiff: http://kdiff3.sourceforge.net/

  • Author
  • Registered
  • August 19, 2017
Thanks Dandie and Charlie. I could achieve the required task. Thanks for support.