Discussions

Expand all | Collapse all

API_DoQuery: How do I code where a field value is one of a series ?

  • 1.  API_DoQuery: How do I code where a field value is one of a series ?

    Posted 10-01-2015 21:32

     E.g. query={6.EX.1 OR 3 OR 7 OR 24 OR 2}.

    In SQL - select * from xyz where [6] in (1,3,7,24,2)




  • 2.  RE: API_DoQuery: How do I code where a field value is one of a series ?

    Top
    Contributor
    Posted 10-01-2015 21:37
    Like this:

    {6.EX.1}OR{6.EX.3}OR{6.EX.7}OR{6.EX.24}OR{6.EX.2}


  • 3.  RE: API_DoQuery: How do I code where a field value is one of a series ?

    Posted 10-01-2015 21:40
    Thanks. I was hoping there was something similar to the HAS/XHAS list, but OR'ing.


  • 4.  RE: API_DoQuery: How do I code where a field value is one of a series ?

    Posted 09-12-2016 16:53
    Hi Dan,

    I'm testing the API_DoQuery with the following code and I'm not getting any result. Could you help me?

    var promise = $.get(dbidcalendar, {

    act: "API_DoQuery",

              query: "{3.EX.178}",

              clist: "3"

    });

    $.when(promise).then(function(xml){

    var recordid = $("rid", xml).text();

    });


    I use something similar for API_AddRecord and API_EditRecord and it works very well. The APP does not have APPTOKEN


  • 5.  RE: API_DoQuery: How do I code where a field value is one of a series ?

    Top
    Contributor
    Posted 09-12-2016 22:04
    log the xml response:

    console.dirxml(xml);

    this will reveal the tag for the record is <record_id_> not <rid>


  • 6.  RE: API_DoQuery: How do I code where a field value is one of a series ?

    Posted 06-12-2018 17:32
    Dan,
    is there a way to not use the field name, but use the field ID instead?
    from: $("record_id_", xml).text();
    to:      $('fid_3', xml).text();


  • 7.  RE: API_DoQuery: How do I code where a field value is one of a series ?

    Top
    Contributor
    Posted 06-12-2018 18:03
    You have to request "structured xml" like this:

    $.get(dbidcalendar, {
      act: "API_DoQuery",
      query: "{3.EX.178}",
      clist: "3.6.7.8",
      fmt: "structured"
    }).then(function(xml) {
      console.dirxml(xml);
      var fid6 = $("f[id=6]", xml).text();
      var fid7 = $("f[id=7]", xml).text();
      var fid8 = $("f[id=8]", xml).text();
    });

    Note your query will always contain just one record  so you can shorten the selectors to just asking for those nodes where the <f> element has an id attribute or 6, 7 or 8 respectively.


  • 8.  RE: API_DoQuery: How do I code where a field value is one of a series ?

    Posted 09-12-2016 22:53
    Awesome. Thanks Dan.