Discussions

Expand all | Collapse all

compare xml files

  • 1.  compare xml files

    Posted 07-05-2017 05:48
    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


  • 2.  RE: compare xml files

    Top
    Contributor
    Posted 07-05-2017 13:12
    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], [Transaction Date] field values that you are interested in seeing in the report.

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


  • 3.  RE: compare xml files

    Posted 07-14-2017 14:57
    If script writing isn't your forte, you could try a tool like kdiff: http://kdiff3.sourceforge.net/


  • 4.  RE: compare xml files

    Posted 08-19-2017 06:49
    Thanks Dandie and Charlie. I could achieve the required task. Thanks for support.