In
SQL you would use a
UNION to combine two result sets.
You can easily accomplish this in QuickBase using script. In the example below I perform
two different queries on
Tutorials table of the
QuickBase Support Center application and join the results into one data representation:
Pastie Database https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=288 Notes: (1) the fact that I made
two queries on the same table is immaterial. You could just as easily have made two queries of two different tables so long as they returned compatible field structures so they can be joined together.
(2) Beyond joining the two queries together you probably need to sort or group the joined results prior to rendering a HTML table of the results. Underscore's _.
groupBy() and _.
sortBy() methods can manipulate the joined data to suit your needs.
(3) You can use Underscore's
_.template () method or Mustache's
Mustache.render() method to merge the data with the report template to generate a HTML report. Both
Underscore and
Mustache are included within QuickBase's pages.
(4) QuickBase's
API_GenResultTable when called with the parameter
&jsa=1 returns a JavaScript array named
qdb_data. My code merely concatenates each copy of the response
qdb_data into the variable
data as each query returns a response.
(5) Use an apptoken in your version of the code (the Support Center Application does not need one).
var apptoken = "your apptoken";
$.ajaxSetup({data: {apptoken: apptoken}});