API_GenResultsTable

Don't forget to check out our JSON RESTful APIs, they can help you utilize and extend Quickbase with ease.

 

Overview

Use API_GenResultsTable to embed a Quickbase table report in an HTML page.

This call is typically used in its URL form embedded in an HTML page. When the HTML page is opened in a browser, the call runs automatically and returns results to qdbWrite() for display in the HTML page.

You can also specify that the results should be returned as a JavaScript array, in CSV format, or as tab separated values.

By default, API_GenResultsTable returns the same number of rows as would be returned in the UI. However, you can specify a different number of rows in your table by including num-n in the options parameter.

You can split a result set into several tables by calling API_GenResultsTable once for each table, using the skp option after the first invocation to skip over the records already returned.

top

Embedding a Quickbase report into a Web page

Use the following procedure to embed a Quickbase report into a Web page on your Web site:

  1. In your Quickbase application, create the table report that you want to embed.

    Note: API_GenResultsTable should only be used with table reports.

  2. In the HEAD section of your Web page, add the following <script> block:

    <script lang="javascript" src="https://target_domain/db/
    target_dbid?a=API_GenResultsTable&qid=5&jht=1&ticket=auth_ticket">
    </script>

    In this block, the target_dbid should be the table ID you want and auth_ticket should be replaced with a valid authentication ticket. (If you don’t supply a ticket, the Quickbase login form appears when the page is opened and the user will have to log in first.) You can also supply your own query here, replacing the query id (qid) above with your own query id. See API_DoQuery for information on building a query.

  3. In the HEAD section of your Web page, add the following style information:

    <style>
    td.m { font-family:verdana; font-size:70%; }
    td.hd { font-family:verdana; font-size:70%; font-weight:bold; color:white;}
    </style>

    By changing the attributes of these CSS tags, you can modify the format of the resulting table.

  4. In the area of the Web page where you want the HTML table to display, add the following JavaScript code:

    <script lang="javascript">
    qdbWrite();
    </script>

top

Request parameters

ParameterValueRequired?

query or

qid or

qname

Specifies the query. You can use any of these three options:

  • Use <query>{myfid.operator.value}</query> to build your own query string.

  • Use <qid>n</qid>if you want to use a saved query and want to use its query ID.

  • Use <qname>myQuery</qname> if you want to use a saved query and refer to it by its query name.

  • See API_DoQuery for information on building your own query.

no

clist

A period-delimited list of field IDs to be returned. Quickbase will return values for these field IDs in the order in which you enter them here.

To return all fields in a table, set this parameter to the value a.

Omit this parameter if you want the query to return the table's default columns.

no

slist

A period-delimited list of field IDs used to determine sorting as follows:

<slist>fid</slist>

The following slist parameter sorts all records by the field whose fid is 7.

<slist>7</slist>

You can specify a secondary sort by including another fid in the string (separating each fid with a period)

<slist>7.12</slist>

URL example:

&slist=7.12

If you don’t specify the sort list, the default sort specified on the Report Layout page determines the order in which records are displayed.

no

jht

Returns the HTML for a table as a JavaScript function named qdbWrite(). You can then embed the HTML table into a Web page by calling the JavaScript function in the area of the Web page where you want the table to display.

Set the value of the parameter to ‘n’ if you want the new look and feel introduced on Apr-12-2003.

Set the value of this parameter ‘1’ if you want the CSS styles that render the HTML table with the Quickbase look and feel prior to Apr-11-2003.

yes

jsa

Set this parameter to 1 if you want the results returned as a JavaScript array.

no

options

A period-delimited list containing any or any combination of the following options:

  • num-n return a maximum of n records
    Note that num-n cannot be combined with the csv or tsv options.

  • onlynew return only those records marked with new or updated flags

  • skp-n skip the first n records returned by the query
    Note that skp-n cannot be combined with the csv or tsv options.

  • sortorder-A for ascending sorts

  • sortorder-D for descending sorts

  • ned to omit the edit icons in HTML table format

  • nvw to omit the view icons in HTML table format

  • nfg to omit the new and updated icons in HTML table format

  • phd for plain (non-hyperlinked) headers

  • abs for absolute URLs

  • csv for comma-separated value output format
    Note that csv cannot be combined with the num-n or skp-n options.

  • tsv for tab-separated value output format
    Note that tsv cannot be combined with the num-n or skp-n options.

yes

ticket

A valid authentication ticket.

The authentication ticket is returned via the API_Authenticate call.

yes, one of:

  • ticket
  • username/password
  • user token

usertoken

The user token is an alternative means of authentication, used for API access. User tokens cannot be used to access the Quickbase UI.

yes, one of:

  • ticket
  • username/password
  • user token

apptoken

A valid application token.

yes, if the application requires application tokens

udata

A string value that you want returned. It will not be handled by Quickbase but it will be returned in the response.

no

top

Response values

If you specify the jht option, the results are written to qbdWrite() embedded in the HTML page. Optionally, if you specify CSV or tab in the options parameter, the return will be comma separated values (CSV) or tab separated values, respectively. If you specified jsa, the JavaScript array is returned.

top

Sample XML Request

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

<qdbapi>
   <ticket>auth_ticket</ticket>
   <apptoken>app_token</apptoken>
   <query>{'11'.CT.'Bob'}AND{'19'.GTE.'5'}</query>
   <clist>6.7.9.11.16</clist>
   <slist>11.6</slist>
   <fmt>structured</fmt>
   <options>num-4.sortorder-D</options>
</qdbapi>

top

URL alternative

https://target_domain/db/target_dbid?a=API_GenResultsTable&ticket=
auth_ticket&apptoken=app_token&qid=5&jht=1&query=
{'6'.CT.'done'}AND{'14'.CT.'USA'}&clist=7.8&slist=6&options=sortorder-A

where target_domain is the domain against which you are invoking this call, for example, quickbase.com. Read about this notation.

top

A Sample Web Page HTML with an Embedded Table

<html>
<head>
<script lang="javascript" src="https://quickbase.com/db/5rh82jcq?a=API_GenResultsTable
      &ticket=auth_ticket&apptoken=app_token
      &qid=5&jht=1">
</script>
<style>
   td.m { font-family:verdana; font-size:70%; }
   td.hd { font-family:verdana; font-size:70%; font-weight:bold;
    color:white;}
</style>
</head>
<body>
<h1>Example</h1>
   <table cellpadding=5 bgcolor=lightgreen>
      <tr>
         <td valign=top nowrap><b>A Quickbase table<br>embedded in
            a<br>page of HTML
         </td>
         <td>
            <script lang="javascript">
               qdbWrite();
            </script>
         </td>
      </tr>
   </table>
</body>
</head>
</html>