How Do "Download All The Things" Your QuickBase?

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

Yo Dawg - how do "Download All The Things" your QuickBase?

Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,024 Points 20k badge 2x thumb

Posted 4 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,024 Points 20k badge 2x thumb
I am a little confused by you reference to "all the things."

Could you be referring to this popular QuickBase technique:

Download All The QuickBase Things
http://i.imgur.com/K2X5uWi.jpg

If I understand your question correctly - and please correctly me if I am wrong - you are asking how to get
arbitrary QuickBase information rapidly saved to your local hard disk with the minimum of user interaction and
complexity. If that is your question the answer is resoundingly yes!

Let me give you a quick demo focusing on extracting the names and dbid's of all the QuickBase tables in an application with the ultimate goal saving a report.csv file to your hard disk. I will show you how to do this first using the JavaScript Console within Chrome's Development Tools but in the end I will make some comments how the whole procedure can be repackaged to be accessed from QuickBase's screens and radically generalized to download anything from QuickBase (even if one of your things does not exist as a standalone entity within QuickBase!)

First using Chrome visit the following application and then press F12 to expose the Chrome Developer Tools:

Northwind Traders
https://haversineconsulting.quickbase.com/db/bf3zb9bph

Second type or copy and paste the following into the Console:


console.table(gTableInfo);


You should see a nicely displayed table with rows for each table in the application and a bunch columns
displaying various values such as the name and dbid for the tables. All we are doing here is displaying
one of QuickBase's global variables (handily QuickBase has over two thousands global living in their pages!) that
happens to contain the information we want access to (the table names and dbid's).

That's fantastic but how do you download all the great information in gTableInfo to your local disk?

It is easy. Just copy the code in this pastie and paste it into the Console:

Pastie Code To Copy and Paste Into Console
http://pastie.org/pastes/10297192/text

The above code creates a new console method which will save an arbitrary object to the specified file name when called like this:


console.save(object, filename);


So let's give it a try by pasting this code into the console:


console.save(gTableInfo, "gTableInfo.json");


Amazingly this will convert the object gTableInfo to JSON and save it to the file gTableInfo.json!

Now you may not have any need for gTableInfo as JSON so I am sure you are asking how you could just get a
CSV file of all the tables names and dbid's saved to disk. Simple, just cut and paste these commands into
the Console:


var heading = "Table, DBID\n";
var report = _
  .chain(gTableInfo)
  .map(function(val, key) {
    return {table:val.name, dbid: key}
  })
  .reduce(function(memo, val) {
    return memo + val.table + ", " + val.dbid + "\n";
  }, heading)
  .value();
console.save(report, "report.csv");


Now you have a file report.csv downloaded to your hard drive that looks like this:


Table, DBID
Customers, bf3zb9bqt
Orders, bf3zb9brt
Order Details, bf3zb9bst
Shippers, bf3zb9bt7
Employees, bf3zb9bu9
Products, bf3zb9bwp
Suppliers, bf3zb9bx3
Categories, bf3zb9bzi


Here is all the above code in one shot (which if you haven't been following the individual steps you could just paste in all at once and catch up):

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=416

Attached are four screenshots of the the process described above along with an edit of report.csv in Excel.


Now I have manually walked you through the proces using the JavaScript Console within Chrome Dev Tools. You could go a step further and place the code into a Chrome Snippet and run it on demand. Or you could integrate it into a user defined page in your application. But here is the big takeaway: You can use this procuedure (and the automatic download feature) to generate any output you desire and save it to disk. All you have to do is gather the data up from wherever it is saved in QuickBase, assemble the output you want with script and trigger the download functionality. You are limited only by your imagination in what you can do.

Have fun:

All The Things
https://www.youtube.com/watch?v=FoUWHfh733Y