lib/QuickBaseClient.rb in quickbase_client-1.0.12 vs lib/QuickBaseClient.rb in quickbase_client-1.0.13
- old
+ new
@@ -3024,18 +3024,37 @@
end
end
# Get a record as a Hash, using the record id and dbid .
# e.g. getRecord("24105","8emtadvk"){|myRecord| p myRecord}
- def getRecord(rid, dbid = @dbid)
+ def getRecord(rid, dbid = @dbid, fieldNames = nil)
rec = nil
- iterateRecords(dbid, getFieldNames(dbid),"{'3'.EX.'#{rid}'}"){|r| rec = r }
+ fieldNames ||= getFieldNames(dbid)
+ iterateRecords(dbid, fieldNames,"{'3'.EX.'#{rid}'}"){|r| rec = r }
if block_given?
yield rec
else
rec
end
end
+
+ # Get an array of records as Hashes, using the record ids and dbid .
+ # e.g. getRecords(["24105","24107"],"8emtadvk"){|myRecord| p myRecord}
+ def getRecords(rids, dbid = @dbid, fieldNames = nil)
+ records = []
+ if rids.length > 0
+ query = ""
+ rids.each{|rid| query << "{'3'.EX.'#{rid}'}OR"}
+ query[-2] = ""
+ fieldNames ||= getFieldNames(dbid)
+ iterateRecords(dbid,fieldNames,query){|r| records << r }
+ end
+ if block_given?
+ records.each{|rec|yield rec}
+ else
+ records
+ end
+ end
# Loop through the list of Pages for an application
def iterateDBPages(dbid)
listDBPages(dbid){|page|
if page.is_a?( REXML::Element) and page.name == "page"