Jump to content

Is there a way to optimize this Find-Replace script?


This topic is 2468 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

I'm writing a find-replace script to change special characters to Unicode code and another script to change them back to special characters (see screenshot). It seems I should be able to assign the "Go to Field" once and run ~1000 Find/Replace(ments) in one go.  I'm not going to switch to another Field during this process.  Is the Script Workspace the right way to do this or would it make sense to have the Find/Replace units in another .fmp12 file?

Best,

Daniel

Screen Shot 2017-06-03 at 22.21.57.png

Link to comment
Share on other sites

Is there a reason why you cannot use the Substitute() function within a single Set Field (or Replace Field Contents, if you're handling multiple records) script step? A single instance of Substitute() can contain up to 999 search/replace pairs, and you can nest multiple instances if you need more.

BTW, if you have a "map" of search/replace pairs that you need to use in both directions, you might consider storing it in a table or hard-coding it to variable/s. Then use a looping script to perform the substitutions. This would be useful if the "map" ever needs to be changed, as it would only require one change for both directions.

 

 

Edited by comment
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...

Thank you for the suggestion.

I migrated the Script replacements to a calculation field using Substitute and it's working fine. It's also blazingly fast.

Best,

Daniel

Link to comment
Share on other sites

This topic is 2468 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.