def findDuplicateRecordIDs(  fnames, fids, dbid = @dbid, ignoreCase = true )
      verifyFieldList( fnames, fids, dbid )
      duplicates = {}
      if @fids
         cslist = @fids.join( "." )
         ridFields = lookupFieldsByType( "recordid" )
         if ridFields and ridFields.last
           cslist << "."
           recordidFid = ridFields.last.attributes["id"]
           cslist << recordidFid
           valuesUsed = {}
            doQuery( @dbid, nil, nil, nil, cslist ) { |record|
               next unless record.is_a?( REXML::Element) and record.name == "record"
               recordID = ""
               recordValues = []
               record.each { |f|
                  if f.is_a?( REXML::Element) and f.name == "f" and  f.has_text?
                     if recordidFid == f.attributes["id"]
                        recordID = f.text
                     else
                        recordValues << f.text
                     end
                  end
              }
              if not valuesUsed[ recordValues ]
                 valuesUsed[ recordValues ] = []
              end
              valuesUsed[ recordValues ] << recordID
            }

            valuesUsed.each{ |valueArray, recordArray|
               if recordArray.length > 1
                 duplicates[ valueArray ] = recordArray
               end
            }
         end
      end
      if block_given?
         duplicates.each{ |duplicate| yield duplicate }
      else
         duplicates
      end
   end
def findDuplicateRecordIDs(  fnames, fids, dbid = @dbid, ignoreCase = true )
      verifyFieldList( fnames, fids, dbid )
      duplicates = {}
      if @fids
         cslist = @fids.join( "." )
         ridFields = lookupFieldsByType( "recordid" )
         if ridFields and ridFields.last
           cslist << "."
           recordidFid = ridFields.last.attributes["id"]
           cslist << recordidFid
           valuesUsed = {}
            doQuery( @dbid, nil, nil, nil, cslist ) { |record|
               next unless record.is_a?( REXML::Element) and record.name == "record"
               recordID = ""
               recordValues = []
               record.each { |f|
                  if f.is_a?( REXML::Element) and f.name == "f" and  f.has_text?
                     if recordidFid == f.attributes["id"]
                        recordID = f.text
                     else
                        recordValues << f.text
                     end
                  end
              }
              if not valuesUsed[ recordValues ]
                 valuesUsed[ recordValues ] = []
              end
              valuesUsed[ recordValues ] << recordID
            }

            valuesUsed.each{ |valueArray, recordArray|
               if recordArray.length > 1
                 duplicates[ valueArray ] = recordArray
               end
            }
         end
      end
      if block_given?
         duplicates.each{ |duplicate| yield duplicate }
      else
         duplicates
      end
   end
Finds records with the same values in a specified list of fields.
 The field list may be a list of field IDs or a list of field names.
 Returns a hash with the structure { "duplicated values" => [ rid, rid, ... ] }