Skip to main content
Question

API_RunImport with Summary table

  • October 11, 2013
  • 0 replies
  • 93 views

Is it possible to use the API_RunImport to create a URL and automatically imports the data in a Summary Report in one table, to another table.

I have one table that has items and their weight, a summary reports sums up all the weight of each item.

I need to generate shipments in another table based on this summary report.

I can easily do it by opening the summary report, clicking import to other table, and importing.

But i would like the end user to do this daily by clicking one button. Is this possible?

I see that this can be done with a Table Report as the source, but I don't see how to do it with a summary report

Thanks,
Joe
This topic has been closed for replies.

Forum|alt.badge.img+6
  • Registered
  • October 12, 2013
I wish you could, but there is no API for that.

But here is a thought.

You probably have a table of items in your app. Create a summary field on that table of Weight Shipped Today. Then make a saved Table to Table copy report to your Shipments Table from the Item Table and just map the fields across. Include a filter on the saved import

where Weight today > 0

so you don't export your whole item table! - just the ones that Shipped today.

  • Registered
  • October 14, 2013
>I wish you could, but there is no API for that.

Come on now don't be ridiculous. Be the API you want to see.

This example below has two tables Source and Destination. The Source table has 20 records (which you can't modify) consisting of fields [Category], [Item], and [Cost]:

Source Records List All
https://haversineconsulting.quickbase.com/db/big4sysbf?a=q&qid=1

The Source table has this summary report:

Source Summary Report
https://haversineconsulting.quickbase.com/db/big4sysbf?a=q&qid=5

You can purge all the records in the Destination table by clicking on the appropriate link shown on the application dashboard.

Summary Report to Table Import Application Dashboard
https://haversineconsulting.quickbase.com/db/big2cgfyv

If you then click on the link labeled "Import Summary Source Report Into Destination Table" on the application dashboard, the data in the summary report will be newly imported into the Destination table.

Here is the code:

DoIt.js User Defined Page
https://haversineconsulting.quickbase.com/db/big2cgfyv?a=dbpage&pagename=DoIt.js

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

In a nutshell here is what the script does: Using a utility function iframeLoaded(id, url) an <iframe> is loaded into the current page (the Source table dashboard) and is hidden from view. The url specified is the Source table summary report. This function returns a jQuery promise which will cause other code to execute when the promise resolves (ie when the <iframe> loads). When the promise resolves, the code reaches into the contents of the newly loaded <iframe> and extracts the tabular data from the summary report, converts it to a blob of csv data and posts it into the Destination table using API_ImportFromCSV. This is all done in about 50 lines of simple code.

If you grock what is going on, you can see that this same technique can implement any custom API you can dream up by ripping data out of any and all QuickBase pages on the planet that you have access to and returning the processed data in any format you want through the use of a promise.

Never let is be said that "there is no API for that". There is nothing but API.

  • Author
  • Registered
  • November 6, 2013
thanks for both answers.  I like to stay in native quickbase when possible, this worked like a charm.  Thanks,
Joe

  • Registered
  • October 16, 2018
Dan, this is great. I think I've got it really close but when I click the button to run the script, I am only creating 200 records at a time.  If I click the button again, it creates 200 more, etc.  Any idea why that may be? 

Also, I turned off the app "use API" option to test this because I figured it might complicate matters.  If I turn it back on, how do you insert the App Token into your script?  Thx!