Method: QuickBase::Client#copyRecord

Defined in:
lib/QuickBaseClient.rb

#copyRecord(rid, numCopies = 1, dbid = @dbid) ⇒ Object

Make one or more copies of a record.



4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
# File 'lib/QuickBaseClient.rb', line 4023

def copyRecord(  rid, numCopies = 1, dbid = @dbid )
   clearFieldValuePairList
   getRecordInfo( dbid, rid ) { |field|
      if field and field.elements[ "value" ] and field.elements[ "value" ].has_text?
         if field.elements[ "fid" ].text.to_i > 5 #skip built-in fields

            addFieldValuePair( field.elements[ "name" ].text, nil, nil, field.elements[ "value" ].text )
         end
      end
   }
   newRecordIDs = Array.new
   if @fvlist and @fvlist.length > 0
      numCopies.times {
        addRecord( dbid, @fvlist )
        newRecordIDs << @rid if @rid and @update_id
      }
   end
   if block_given?
      newRecordIDs.each{ |newRecordID| yield newRecordID }
   else
      newRecordIDs
   end
end