def getAllValuesForFields( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
      if dbid

         getSchema(dbid)
         
         values = {}
         fieldIDs = {}
         if fieldNames and fieldNames.is_a?( String )
            values[ fieldNames ] = []
            fieldID = lookupFieldIDByName( fieldNames )
            if fieldID 
               fieldIDs[ fieldNames ] = fieldID 
            elsif fieldNames.match(/[0-9]+/) # assume fieldNames is a field ID  
               fieldIDs[ fieldNames ] = fieldNames
            end
         elsif fieldNames and fieldNames.is_a?( Array )
            fieldNames.each{ |name|
               if name
                  values[ name ] = []
                  fieldID = lookupFieldIDByName( name )
                  if fieldID
                     fieldIDs[ fieldID ] = name 
                  elsif name.match(/[0-9]+/) # assume name is a field ID
                     fieldIDs[ name ] = name
                  end
               end
            }
         elsif fieldNames.nil?
            getFieldNames(dbid).each{|name|
                  values[ name ] = []
                  fieldID = lookupFieldIDByName( name )
                  fieldIDs[ fieldID ] = name
            }         
         end
         
         if clist
            clist << "."
            clist = fieldIDs.keys.join('.')
         elsif qid.nil? and qname.nil?
            clist = fieldIDs.keys.join('.')
         end
         
         if clist
            clist = clist.split('.')
            clist.uniq!
            clist = clist.join(".")
         end

         doQuery( dbid, query, qid, qname, clist, slist, fmt, options )

         if @records and values.length > 0 and fieldIDs.length > 0
            @records.each { |r|
               if r.is_a?( REXML::Element) and r.name == "record"
                  values.each{ |k,v| v << "" }
                  r.each{ |f|
                     if f.is_a?( REXML::Element) and f.name == "f"
                       fid = f.attributes[ "id" ]
                       name = fieldIDs[ fid ] if fid
                       if name and values[ name ]
                          v = values[ name ]
                          v[-1] = f.text if v and f.has_text?
                       end
                     end
                  }
               end
            }
         end
      end

      if values and block_given?
         values.each{ |field, values| yield field, values }
      else
         values
      end
    end
def getAllValuesForFields( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
      if dbid

         getSchema(dbid)
         
         values = {}
         fieldIDs = {}
         if fieldNames and fieldNames.is_a?( String )
            values[ fieldNames ] = []
            fieldID = lookupFieldIDByName( fieldNames )
            if fieldID 
               fieldIDs[ fieldNames ] = fieldID 
            elsif fieldNames.match(/[0-9]+/) # assume fieldNames is a field ID  
               fieldIDs[ fieldNames ] = fieldNames
            end
         elsif fieldNames and fieldNames.is_a?( Array )
            fieldNames.each{ |name|
               if name
                  values[ name ] = []
                  fieldID = lookupFieldIDByName( name )
                  if fieldID
                     fieldIDs[ fieldID ] = name 
                  elsif name.match(/[0-9]+/) # assume name is a field ID
                     fieldIDs[ name ] = name
                  end
               end
            }
         elsif fieldNames.nil?
            getFieldNames(dbid).each{|name|
                  values[ name ] = []
                  fieldID = lookupFieldIDByName( name )
                  fieldIDs[ fieldID ] = name
            }         
         end
         
         if clist
            clist << "."
            clist = fieldIDs.keys.join('.')
         elsif qid.nil? and qname.nil?
            clist = fieldIDs.keys.join('.')
         end
         
         if clist
            clist = clist.split('.')
            clist.uniq!
            clist = clist.join(".")
         end

         doQuery( dbid, query, qid, qname, clist, slist, fmt, options )

         if @records and values.length > 0 and fieldIDs.length > 0
            @records.each { |r|
               if r.is_a?( REXML::Element) and r.name == "record"
                  values.each{ |k,v| v << "" }
                  r.each{ |f|
                     if f.is_a?( REXML::Element) and f.name == "f"
                       fid = f.attributes[ "id" ]
                       name = fieldIDs[ fid ] if fid
                       if name and values[ name ]
                          v = values[ name ]
                          v[-1] = f.text if v and f.has_text?
                       end
                     end
                  }
               end
            }
         end
      end

      if values and block_given?
         values.each{ |field, values| yield field, values }
      else
         values
      end
    end
Get all the values for one or more fields from a specified table.

 e.g. getAllValuesForFields( "dhnju5y7", [ "Name", "Phone" ] )

 The results are returned in Hash, e.g. { "Name" => values[ "Name" ], "Phone" => values[ "Phone" ] }
 The parameters after 'fieldNames' are passed directly to the doQuery() API_ call.

  Invalid 'fieldNames' will be treated as field IDs by default,  e.g. getAllValuesForFields( "dhnju5y7", [ "3" ] )
  returns a list of Record ID#s even if the 'Record ID#' field name has been changed.