0

Duplicate several records with changing one of the fild values

Hello!

I need help, guys!
How can i duplicate lets say 10 records of a table simultaneously (not one by one), and at the same time automatically changing some text in one of the text fields? The new text will be the same for all records.

The records to be duplicated can be selected by a value of one of the fields.

2 replies

null
    • Fred
    • 7 mths ago
    • Reported - view

    You could try something like this in a button:

    let findRecs := select tablename where fieldname = something;
    for loop1 in findRecs do
        let newRec := duplicate(loop1);
        newRec.(
            fieldToChange := newValue
        )
    end
    

    Line 1, we need to create an array of the records you want to duplicate, so we use the select command and the where parameter to only find the records you need. Make sure to put in the proper table name, field name and search parameter.

    Lines 2 - 7, is the for loop that will go through the array from line 1 and duplicate each record. Then it will take the newly duplicated record and change a field to a new value. Make sure you put in the correct field name and value.

      • Agassi
      • 7 mths ago
      • Reported - view

       Thank you for your help!!

      The code works very well!

       

      Thanks a lot!

Content aside

  • 7 mths agoLast active
  • 2Replies
  • 29Views
  • 2 Following