Loop through records joined from two or more tables
join loop multiple tables
You need to read records from multiple tables, join records that share the same values is specific fields, and loop through the joined records.

require 'QuickBaseClient'

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

# make a list of the tables to be joined
tablesToJoin = Array.new

table1 = Hash.new
table1["dbid"]="bccr737mz"              #table id
table1["fields"] = Array["a","b","c"] #fields to retrieve
table1["joinfield"] = "c"                 #field to compare across all tables' records
tablesToJoin << table1

table2 = Hash.new
table2["dbid"]="bccr737m2"
table2["fields"] = Array["c","d","e"]
table2["joinfield"] = "c"
tablesToJoin << table2

table3 = Hash.new
table3["dbid"]="bccr737m3"
table3["fields"] = Array["cc","g","gf"]
table3["joinfield"] = "cc"
tablesToJoin << table3

puts "------ Joined records from 3 tables ------"
recnum = 1
qbc.iterateJoinRecords(tablesToJoin) {|joinedRecord|
   print "\n#{recnum}. "
   joinedRecord.each{|field,value|
      print "#{field}: #{value}, "
   }
   recnum += 1
}

=begin

The output using unrealistically simple data is below.
Note that field 'c' is in two tables and is merged.
The value of 'c' from the second table is included in the joined record.

------ Joined records from 3 tables ------

1. cc: c, a: a2, b: b2, c: c, d: d, e: e, g: g, gf: sda,
2. cc: c, a: a2, b: b2, c: c, d: sadf, e: df, g: cv, gf: sdafad,
3. cc: c, a: a2, b: b2, c: c, d: sadf, e: df, g: sad, gf: sad,
4. cc: c, a: a2, b: b2, c: c, d: d, e: e, g: sad, gf: sad,
5. cc: c, a: a2, b: b2, c: c, d: sadf, e: df, g: g, gf: sda,
6. cc: c, a: a2, b: b2, c: c, d: sadf, e: df, g: cv, gf: sdafad,
7. cc: c, a: a2, b: b2, c: c, d: d, e: e, g: sad, gf: sad,
8. cc: c, a: a2, b: b2, c: c, d: sadf, e: df, g: sad, gf: sad,
9. cc: c, a: a2, b: b2, c: c, d: sadf, e: df, g: g, gf: sda,
10. cc: c, a: a2, b: b2, c: c, d: d, e: e, g: cv, gf: sdafad,
11. cc: c, a: a2, b: b2, c: c, d: sadf, e: df, g: sad, gf: sad,
12. cc: c, a: a, b: b, c: c, d: d, e: e, g: g, gf: sda,
13. cc: c, a: a, b: b, c: c, d: sadf, e: df, g: cv, gf: sdafad,
14. cc: c, a: a, b: b, c: c, d: sadf, e: df, g: sad, gf: sad,
15. cc: c, a: a, b: b, c: c, d: d, e: e, g: sad, gf: sad,
16. cc: c, a: a, b: b, c: c, d: sadf, e: df, g: g, gf: sda,
17. cc: c, a: a, b: b, c: c, d: sadf, e: df, g: cv, gf: sdafad,
18. cc: c, a: a, b: b, c: c, d: d, e: e, g: sad, gf: sad,
19. cc: c, a: a, b: b, c: c, d: sadf, e: df, g: sad, gf: sad,
20. cc: c, a: a, b: b, c: c, d: sadf, e: df, g: g, gf: sda,
21. cc: c, a: a, b: b, c: c, d: d, e: e, g: cv, gf: sdafad,
22. cc: c, a: a, b: b, c: c, d: sadf, e: df, g: sad, gf: sad,

=end
This is similar to the SQL JOIN statement.
iterateJoinRecords.rb
One-Click Ruby Installer for Windows Ruby wrapper for QuickBase HTTP API
Created on Feb.  7, 2007 at 11:11 PM (PST). Owned by 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