Method: QuickBase::Client#min
- Defined in:
- lib/QuickBaseClient.rb
#min(dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil) ⇒ Object
Find the lowest value for one or more fields in the records returned by a query. e.g. minimumsHash = min(“dfdfafff”,[“Date Sent”,“Quantity”,“Part Name”])
3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 |
# File 'lib/QuickBaseClient.rb', line 3973 def min( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", = nil ) min = {} hasValues = false iterateRecords(dbid,fieldNames,query,qid,qname,clist,slist,fmt,){|record| fieldNames.each{|field| value = record[field] if value baseFieldType = lookupBaseFieldTypeByName(field) case baseFieldType when "int32","int64","bool" value = record[field].to_i when "float" value = record[field].to_f end end if min[field].nil? or (value and value < min[field]) min[field] = value hasValues = true end } } min = nil if not hasValues min end |