QuickBase API Cookbook v3 - Recipe #86
Make a slideshow in QuickBase from a folder of picture files
slide show slideshow picture folder
You want to use QuickBase to display a sequence of web pages containing 'slides' containing the picture files from a folder on your local computer.
require 'QuickBaseClient'
require 'QuickBaseMisc'

username = ARGV[0] || ENV["quickbase_username"] 
password = ARGV[1] || ENV["quickbase_password"] 

qbc = QuickBase::Client.new(username,password)

cwd = Dir.pwd.gsub('/','\\')

dbid = qbc.findDBByName(cwd)
if dbid.nil?
  dbid = qbc.createDatabase(cwd,"#{username}'s slide show from #{cwd}.")
  qbc.addField(dbid,"Picture","file")
  qbc.addField(dbid,"HtmlPage","file")
else  
  qbc.getSchema(dbid)
  dbid = qbc.lookupChdbid(cwd.dup)
  qbc.getSchema(dbid)
end  
pictureFieldID = QuickBase::Misc.decimalToBase32(6)
htmlPageFieldID = QuickBase::Misc.decimalToBase32(7)
Dir.foreach(cwd){|file|
  next unless [".jpeg", ".jpg",".gif",".bmp",".png"].include?(file.downcase[file.rindex('.'),file.length])
  renamedFile = file.dup
  renamedFile.gsub!("&","And")
  renamedFile.gsub!("'"," ")
  if renamedFile != file
     File.rename(file,renamedFile)
  end
  puts "Uploading #{renamedFile}"
  rid, updateid = qbc.uploadFile(dbid, renamedFile.dup, "Picture")
  thisRid = QuickBase::Misc.decimalToBase32(rid.to_i)
  prevRid = QuickBase::Misc.decimalToBase32(rid.to_i-1)
  nextRid = QuickBase::Misc.decimalToBase32(rid.to_i+1)
  pictureURL = "https://www.quickbase.com/up/#{dbid}/g/r#{thisRid}/e#{pictureFieldID}/va/#{renamedFile.dup}"
  prevHtmlURL = "https://www.quickbase.com/up/#{dbid}/g/r#{prevRid}/e#{htmlPageFieldID}/va/slide.html"
  nextHtmlURL = "https://www.quickbase.com/up/#{dbid}/g/r#{nextRid}/e#{htmlPageFieldID}/va/slide.html"
  html = "<center><img src=\"#{pictureURL}\" /><br>#{renamedFile.dup}<b>#{}</b><hr><a href=\"#{prevHtmlURL}\">Previous</a> <a href=\"#{nextHtmlURL}\">Next</a></center>"
  File.open("slide.html","w"){|f|f.write(html)}
  qbc.updateFile(dbid,rid,"slide.html","HtmlPage")
}
Note: This script must be run from the folder containing the picture files, and you must supply your QuickBase username and password on the command line or in environment variables "quickbase_username" and "quickbase_password".

The script will create or update a QuickBase application with the same name as the folder your are in on your local computer.  To begin the slideshow, click on the "slide.html" file in the first QuickBase record in the database.

makeSlideShow.rb
Ruby wrapper for QuickBase HTTP API One-Click Ruby Installer for Windows
Created on March 14, 2008 at  5:49 PM (PDT). Last updated by Quick Base on March 14, 2008 at  6:29 PM (PDT). Owned by Quick Base.
Quick Base
Quick Base
Show fields from Show fields from Show fields from a related table
Report Name *
Description
Reports and Charts Panel
Each table has a panel listing its reports and charts, organized in groups.
Please wait while your new report is saved...
Field label
Column heading override
Justification
What does auto mean?
Fields in:

Fields to Extract:

Name for the new table:
Items in the new table are called:

When you bring additional fields into a conversion, Quickbase often finds inconsistencies. For example, say you're converting your Companies column into its own table. One company, Acme Corporation, has offices in New York, Dallas and Portland. So, when you add the City column to the conversion, Quickbase finds three different locations for Acme. A single value in the column you're converting can only match one value in any additional field. Quickbase needs you to clean up the extra cities before it can create your new table. To do so, you have one of two choices:

  • If you want to create three separate Acme records (Acme-New York, Acme-Dallas and Acme-Portland) click the Conform link at the top of the column.
  • If the dissimilar entries are mistakes (say Acme only has one office in New York and the other locations are data-entry errors) go back into your table and correct the inconsistencies—in this case, changing all locations to New York. Then try the conversion again.

Read more about converting a column into a table.

We're glad you're interested in doing more with Quickbase!

Now we need to make you official before you share apps or manage your account.

Verifying your email lets you share Quickbase with others in your company.

Your work email
Your company