1 Reply Latest reply on Jul 22, 2014 5:22 PM by nihmbrisby

    Find records only containing a subset of text

    TopherKessler

      Title

      Find records only containing a subset of text

      Post

           I have a number of records with a field that contains the same text, but some have additional text, such as the following (each line here represents a different record for this field):

           sometext

           sometext

           sometext

           additionaltext sometext

           additionaltext sometext

           additionaltext sometext

           What I need to do is search for all of the records that only contain "sometext" and replace them all with "additionaltext sometext." When I use the "find/replace" feature to search for "sometext" it includes all of the above records, so records with "additionaltext sometext" will be changed to "additionaltext additionaltext sometext," which is an undesired result.

           It would be great if there was a way to have the find/replace feature be specific to find fields that contain ONLY the specified text, and then have an option to replace the contents of those fields.

           I can do this by first searching and then replacing the contents for all found fields; however, in my case i have about 5000 records, with about 400-500 different combinations of "sometext" and "additionaltext sometext" so I would have to do about 400-500 sortings to update all the data the way I want.

           In trying to avoid this tedious endeavor, are there any suggestions for how to go about scripting or otherwise automating this? Basically, I need to loop through all of my records with the logic: if "sometext" only, then replace with "additionaltext sometext" and do this for all variants of "sometext."

        • 1. Re: Find records only containing a subset of text
          nihmbrisby

               Search for "sometext" using the exact field match operator == (two equal signs in a row).  The resulting found set should only contain records in which the field contains precisely "sometext".  Now select (ie put your cursor in) the field in question.  Change it to the value you want all records in your found set to have.  Now go to the records menu and choose "Replace Field Contents" (it's near the bottom).  A menu will appear.  I believe the first of the three options will accomplish what you're trying to do.  I'm assuming this can't be undone so be very careful (and make a back up).