1 Reply Latest reply on Jan 31, 2012 2:36 PM by philmodjunk

    Duplicate Found Set of Records



      Duplicate Found Set of Records


      I found a post that answers my question perfectly regarding duplicating a found set of records. However, I have one more trick. My record name (or ID) consists of 6 variables. For example AB12US. The middle two variables represent the year. There is also a year field that I would need updated. So, I want this script to duplicate the record and replace the year field with the next year (add 1) and also update the record name with AB13US. Any ideas?


      Here's how I'd do it:

      Freeze Window
      Enter Find Mode[] clear pause check box
      Set Field [Table1::DateActual ; Table1::Date Find ]
      Set Error capture [on]
      Perform Find []
         Exit Loop if [ get ( FoundCount ) = 0 ]
         Duplicate Record/Request
         Set Field [Table1::DateActual ; Table1::DateReplace ]
         omit record
         go To record/request/page [first]
         omit Record
      End Loop
      Enter Find Mode[]
      Set Field [ table1::DateActual ; Table1::DateReplace ]
      Perform Find[]

        • 1. Re: Duplicate Found Set of Records

          I would not use such a field as a Primary Key. If it is needed to support current business practices, make it a data field, but don't use it in relationships as a primary key.

          Hope Date Find and DateReplace are fields with global storage specified or your script won't work. Wink

          Set Field [Table1::RecordName ; Left ( Table1::RecordName ; 2 ) & Right ( Year ( Table1::DateReplace ) ; 2 ) & Right ( Table1::RecordName ; 2 ) ]