Make an intranet site ASAP that connects to QuickBase
intranet site
You need to create a simple intranet web site very quickly and it must be connected to QuickBase.
require 'rubygems'
require 'ramaze'
require 'QuickBaseClient'
require 'cgi'

#-----------------------------------------------------------  
class MainController < Ramaze::Controller

  map '/'
  layout :page
   
  #-----------------------------------------------------------  
  def index
      @title = "Intranet"
      html =   "<form method=\"post\" action=\"/listQuickBaseApplications\">"
      html << "<p>User name:<input type=\"text\" name=\"username\"></input></p>" 
      html << "<p>Password :<input type=\"text\" name=\"password\"></input></p>"
      html << "<input type=\"submit\" name=\"my_quickbase\" value=\"My QuickBase.\">"     
      html << "</form>"     
   end  
  
  #-----------------------------------------------------------  
  def listQuickBaseApplications
     @title = "My QuickBase"
     if request['username'] and request['password']
      @qbc = QuickBase::Client.new(request['username'], request['password']) 
      if @qbc and @qbc.requestSucceeded
         html = ""
         grantedDBname = ""
         grantedDBid = ""
         dbproc = proc { |element|
            if element.is_a?(REXML::Element)
               if element.has_text? 
                  if element.name == "dbname"
                    grantedDBname = element.text
                  elsif element.name == "dbid"
                    grantedDBid = element.text
                  end  
               end
            end
         }
         @qbc.grantedDBs("1","1","1"){|grantedDB|
             @qbc.processChildElements(grantedDB,true,dbproc)
             html << "<br>(<a href=\"/showSchema/#{CGI.escape(request['username'])}/#{CGI.escape(request['password'])}/#{grantedDBid}/#{CGI.escape(grantedDBname)}\">schema</a>) <a href=\"https://www.quickbase.com/db/#{grantedDBid}\">#{grantedDBname}</a>" 
         }         
         html
      else
       "<p><b>Oops - something went wrong while connecting to QuickBase.<br>Please check your username and password.</b></p>"
      end    
     else
       "<p><b>Oops - please specifiy your QuickBase username and password.</b></p>"
     end  
  end     

  #-----------------------------------------------------------  
  def showSchema(username,password,dbid,dbname)
     @title = "#Schema for {dbname}"
      html = "Oops - couldn't find the schema for that table."
      @qbc = QuickBase::Client.new(username,password)
      if @qbc and @qbc.requestSucceeded
         @qbc.getSchema(dbid)
         if @qbc.requestSucceeded
           schema = ""
           
           # if you get 'undefined variable transitive' from the next line
           # edit rexml\document.rb and change 'trans=false' to ''transitive=false'
           @qbc.qdbapi.write(schema, 3)
           
           schema.gsub!("<","&lt;")
           schema.gsub!(">","&gt;")
           html = "<pre>#{schema}</pre>" 
         end
       end   
      html 
    end
    
  #-----------------------------------------------------------  
  def error
      "<p><b>Sorry - that is not a valid web page on this web site.</b></p>"
  end  

  #-----------------------------------------------------------  
   def page
    %{
<html>
  <head>
    <title>#@title</title>
  </head>
  <body>
    <h2>#@title</h2><a href ="/index">Home</a> 
    <hr>
    #@content
  </body>
</html>
    }
  end
 end
 
 Ramaze.start
 
Most people have heard of Ruby on Rails.  There is now a next generation of Ruby web application frameworks that are even simpler than Rails and that are solid and flexible enough for at least  intranet purposes.

The example above makes a web site that lists the applications and tables you can access and displays the XML schema for selected tables.
intranet.rb
One-Click Ruby Installer for Windows Ruby wrapper for QuickBase HTTP API Ramaze ruby web framework
Created on Feb. 11, 2008 at  8:28 AM (PST). Last updated by Quick Base on Feb. 18, 2008 at  2:58 PM (PST). 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