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

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered

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: 

Photo of Yuri

Yuri

  • 0 Points

Posted 4 years ago

  • 0
  • 1
Photo of Eric

Eric

  • 40 Points
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>
Photo of Yuri

Yuri

  • 0 Points
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.
Photo of Shankar Ravi

Shankar Ravi

  • 280 Points 250 badge 2x thumb
Hi,

Can I display same API_DoQuery data in HTML table instead of drop down list? I do not want to use API_GenResults.
(Edited)
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,204 Points 20k badge 2x thumb
Honestly I don't understand what you or any of the prior questions and answers are talking about. Post a new message with more details of what you are trying to accomplish.
Photo of Shankar Ravi

Shankar Ravi

  • 280 Points 250 badge 2x thumb
Hi,

I want to create/generate product gallery view in quickbase like Amazon or Flipkart product gallery view. I am trying to implement that functionality in quickbase using HTML and Javascript.

I have seen record number 18 in your pasties, you have given example to display API_DoQuery data in drop down. So I was trying to display same data in HTML table view without using quickbase API (API_GenResults table)

Did you understand my question now?

Regards,
Ravi
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,204 Points 20k badge 2x thumb
Nope

Pastie #18 has no reference to "API_DoQuery data in drop down" . It does use "API_GenResultsTable" to query the old QuickBase forum and multiplies the [Message ID#] times the number reply posts (whatever that means) and appends it to a new column in a table. The demo is broken because the jQuery file is no longer in its original position:

https://www.quickbase.com/js/jquery-1.4.2.min.js

https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=18

Bottom line is that this thing is seven years old and I still don't know what you are asking. I don't mean so sound harsh (I am happy to answer your question) but you got to put a little more effort into accurately forming your question and realize the anything this old is too old to use.

Just ask a new question stating exactly what you want to accomplish.
(Edited)
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,204 Points 20k badge 2x thumb
Relive the moment!

Record ID #1 - Created 05-02-2000
https://qbexchange.quickbase.com/db/8emtadvk?a=dr&rid=1
Photo of Shankar Ravi

Shankar Ravi

  • 280 Points 250 badge 2x thumb
I got confused with post title.

PostTitle : "Display Do_Query API results in drop down list"

Sorry.

I am posting my question in new post.

Regards,