lib/QuickBaseClient.rb in quickbase_client-1.0.11 vs lib/QuickBaseClient.rb in quickbase_client-1.0.12
- old
+ new
@@ -3408,11 +3408,11 @@
raise "'iterateRecords' must be called with a block."
end
end
# Same as iterateRecords but with fields optionally filtered by Ruby regular expressions.
- # e.g. iterateFilteredRecords( "dhnju5y7", [{"Name" => "[A-E].+}","Address"] ) { |values| puts values["Name"], values["Address"] }
+ # e.g. iterateFilteredRecords( "dhnju5y7", [{"Name" => "[A-E].+"},"Address"] ) { |values| puts values["Name"], values["Address"] }
def iterateFilteredRecords( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
fields = []
regexp = {}
fieldNames.each{|field|
if field.is_a?(Hash)
@@ -3426,27 +3426,33 @@
iterateRecords(dbid,fields,query,qid,qname,clist,slist,fmt,options){|record|
if regexp
match = true
fields.each{|field|
if regexp[field]
- match = false if not record[field].match(regexp[field])
+ unless record[field] and record[field].match(regexp[field])
+ match = false
+ break
+ end
end
}
yield record if match
else
yield record
end
}
end
- # e.g. getFilteredRecords( "dhnju5y7", [{"Name" => "[A-E].+}","Address"] ) { |values| puts values["Name"], values["Address"] }
+ # e.g. getFilteredRecords( "dhnju5y7", [{"Name" => "[A-E].+"},"Address"] ) { |values| puts values["Name"], values["Address"] }
def getFilteredRecords( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
filteredRecords = []
iterateFilteredRecords(dbid, fieldNames, query, qid, qname, clist, slist, fmt, options){ |filteredRecord|
filteredRecords << filteredRecord
}
filteredRecords
end
+
+ alias findRecords getFilteredRecords
+ alias find_records getFilteredRecords
# Get records from two or more tables and/or queries with the same value in a
# 'join' field and loop through the joined results.
# The 'joinfield' does not have to have the same name in each table.
# Fields with the same name in each table will be merged, with the value from the last