Skip to main content
Question

Converting GetSchema API query result into a query for the Do_Query API?

  • October 12, 2015
  • 0 replies
  • 70 views

So I have a query from the GetSchema API, I want to get the records in that query without using the query id.

If I simply use the same exact result I get from the Getschema API, then oddly I get a list of queries rather than a list of records. 

Here is an example of a result I get from the GetSchema API

<query id="79">

          <qyname>text</qyname>

          <qytype>table</qytype>

          <qydesc>-Description text</qydesc>

          <qycrit>(({&#039;481&#039;.EX.&#039;text1 &#039;}OR{&#039;481&#039;.EX.&#039;text2&#039;})AND{&#039;391&#039;.XCT.&#039;cancel&#039;})</qycrit>

          <qyclst>65.92.94.91.93.-1</qyclst>

          <qyslst>481</qyslst>

          <qyopts>so-A.gb-V.not.</qyopts>

 <qycalst>0.0</qycalst>

          <qyform>[14/15 TA $MM]+[15/16 TA $MM]+[16/17 TA $MM]</qyform>

          <qyflbl>more text</qyflbl>

          <qyftyp>CA</qyftyp>

          <qyfplac>0</qyfplac>

        </query>


it looks like if I just remove "qy" from in front of everything I'll get the results I want but I'm not sure if its that simple.... is there a more formal way of doing this?


pdate: 

This topic has been closed for replies.

  • Quickbase Alumni
  • October 20, 2015
Yes, it sounds like you're close. I just ran an API_GetSchema for a test application that I own, and here's one of the queries I saw returned:

<query id="10"> <qyname>Calendar Of Open Tasks By Project</qyname> <qytype>calendar</qytype> <qydesc> Calender view of open tasks due this month by project </qydesc> <qycrit>{'56'.CT.'_ask1_'}AND{'12'.XEX.'Completed'}</qycrit> <qyclst>184</qyclst> <qyslst>77.184</qyslst> <qyopts>so-AA.gb-D.hwe.cab.cmx-30.</qyopts> <qycalst>-1.0</qycalst> <qycalend>10</qycalend> </query> According to the API_DoQuery documentation here: http://www.quickbase.com/api-guide/index.html#do_query.html you need to use parameter names like <options> instead of <opts> so it's not as simple as removing the "qy" portion of what's returned. If you can parse through the XML returned by your GetSchema command, the qycrit is the query portion, the qyclist would go to the clist parameter, the qyslist would go to the slist parameter, and the qyopts would go to the options parameter. For example, your structure would look like this:

POST https://target_domain/db/target_dbid HTTP/1.0
Content-Type: application/xml
Content-Length:
QUICKBASE-ACTION: API_DoQuery


<qdbapi>
   <ticket>auth_ticket</ticket>
   <apptoken>app_token</apptoken>
   <udata>mydata</udata>
   <query>(
{'481'.EX.'text1'}OR{'481'.EX.'text2'})AND{'391'.XCT.'cancel'}</query>

   <clist>65.92.94.91.93.-1</clist>
   <slist>481</slist>
   <options>
so-A.gb-V.not.</options>
</qdbapi>

  • Author
  • Quickbase Alumni
  • October 20, 2015
So yes there is no official way of converting it so this is what I ended up doing. From a development standpoint this type of thing essentially needs to handed over locally. You'll also find that you may have to parse the options, columns and sort as they are "." separated.

  • Quickbase Alumni
  • February 9, 2018
Hi,

Can I display same API_DoQuery data in HTML table instead of drop down list? I do not want to use API_GenResults.