3 Replies Latest reply on Oct 30, 2016 9:05 PM by user19752

    Any ideas why my find/replace script does not work?

    user26705

      I have a solution where the user presses a button and executes a script to import records into a table (Table A) from (Table B).  This works fine and without issue.  The issue is that after the import of records into Table A, I want the script to automatically perform a Find/Replace that replaces all instances of #CE# with the contents of variable $EntityName.

       

      This is the script I wrote is as follows:

       

      Window Freeze

       

      ....Import Stuff That Works...

       

      Go to Layout ["Table A" (TableA)]

      Go to Record/Request/Page [First]

       

      Perform Find/Replace [With dialog: On ; "#CE#", $CELongName; Replace All]

      Go to Layout ["Import Manager" (TableB)]

       

       

      Here is the issue:

       

      When the script runs the dialog appears and I double check that the variable has set the replace field correctly (which it has) and then tell it to "Replace All" - but nothing happens...nada...

       

      but...if I actually goto the Table A layout manually and perform the Find/Replace (which is still populated with the variables from the script) it works.  It just will not work when called from the script.

       

      Any ideas?

       

      ...

        • 1. Re: Any ideas why my find/replace script does not work?
          user19752

          You need

          Go to Field [where you want to replace]

           

          I prefer "Replace Field Contents" instead of "Find/Replace".

          • 2. Re: Any ideas why my find/replace script does not work?
            user26705

            Thank you for the response...

             

            ...I am curious about the Go to Field [ ] - I set the Find/Replace in my script to "Search Within All Fields" - shouldn't that force it to go to all fields?  It does when run manually.

             

            I have 25 fields, so just a pain to do a Go to Field then Find/Replace...

             

            I appreciated the suggestion on "Replace Field Contents" but I am an looking to replaced a specific word in the field not the entire field ...so not sure Replace Field Contents would work - but willing to give it a try.

            • 3. Re: Any ideas why my find/replace script does not work?
              user19752

              Hmm, I assumed you replace one field, since database usually have different information in each field.

              You can find/replace "All Fields" but script step don't show how you specified the option, this is bad of script workspace, not us.

              "Replace All" means "all occurrences", not "all fields" nor "all records", did you confirm it in "options" in dialog?

              Sctipt option "With dialog:on" shows only "OK/cancel" dialog, that can't set option at the time.

               

              I agree, if you need doing same replacement on 25 fields, it is a bit work for "RFC". It can be done with

              Substitute ( aField ; "#CE#" ; $CELongName )

              but you need 25 script steps or looping 25 times.

               

              Your variable name is first written as $EntityName, is this correct?