3 Replies Latest reply on Aug 17, 2015 4:54 PM by PhilCornish

    Insert text into field on multiple records in found set

    PhilCornish

      Title

      Insert text into field on multiple records in found set

      Post

      I have a found set of records with varrying text in a field but I would like to add one new line of text to all of them while preserving the existing text.  The new line of text should be at the top above the existing text, thereby pushing the existing text down a line.  The replace feature would wipe out my existing text, as would importing and "Updating existing records."  The found set is large, so hoping to automate rather than accomplish this record by record with pasting and manual carriage returns.

      I am on 14.

      Any ideas?  Thanks!

        • 1. Re: Insert text into field on multiple records in found set
          SteveMartino

          You can still use Replace Field Contents>Replace with calculated results, and type this into the calculation box:

          Say it's the YourTable::notesField, type in

          "This is the new sentence I want inserted." & "¶" & YourTable::notesField.  You can also wrap the new sentence in some text formatting so it sticks out (italic, bold, different color) or add a timestamp.

          This will insert your new sentence (text), a carriage return and the previous contents of the field.

          Few things.  Try it on a copy of your database first.  Make sure you are in the correct field. It doesn't consider record locking, so if another user has a record open it will fail

          This can also be scripted, where you pop up a dialog, type the sentence and it performs the replace field contents calculation in the correct field

          • 2. Re: Insert text into field on multiple records in found set
            philmodjunk

            I prefer:

            List ( "This is the new sentence I want inserted." ; YourTable::notesField )

            Should notes field be empty, you don't get an extra, unneeded return after the inserted text.

            A bit more on record locking. If another user locks one of the records you are trying to update, you will get an error message telling you that one of the records was not updated. Unfortunately, it won't tell you which record didn't get updated. It is possible for a script to detect an error, pull up a new found set of the records that didn't get updated and try again, but if you can make sure that no other users are editing the records you want to update at the time you do it, life is much simpler.

            • 3. Re: Insert text into field on multiple records in found set
              PhilCornish

              Thanks guys, very helpful.  You just saved me a buttload of time.  I tried Steve's method first and it worked, but I'm sure PhilMod's method is great too.