innodes Posted May 29, 2009 Share Posted May 29, 2009 Is there a way to search a text string for a list (value list?) of specific terms and replace them? Specifically: 1 - User entry - types text line 2 - Calc field with "Proper" function cleans text. 3 - Writes cleaned text to description field. . . . this part is running fine. The challenge is that we have some terms that need to be caps (ie. ABC, CBS, JVC, IBM, II, etc.) within the text string. Is it possible to have a running list of these terms that can be checked against? If found, it would replace only those letters with the all caps version. I would like to insert that function between 2 & 3. thanks, Link to comment Share on other sites More sharing options...
comment Posted May 29, 2009 Share Posted May 29, 2009 It's possible, but it would require either a custom (recursive) function or a looping script, since each word needs to be processed individually. Another difficulty is to preserve punctuation marks. Link to comment Share on other sites More sharing options...
Lee Smith Posted May 29, 2009 Share Posted May 29, 2009 (edited) I just tested the custom function Here and it seems to work. HTH Lee [color:red]ps I notice a small glitch in this CF, if you have any variations of abc, ibm, etc, it will need to be added to the list. i.e. Abc, or Ibm Edited May 29, 2009 by Guest ps Link to comment Share on other sites More sharing options...
innodes Posted July 21, 2009 Author Share Posted July 21, 2009 OK, I have been playing a bit, and have some success, but don't know how to check a single field through a list of 27 options. Here is what I have, and it works, but just for one option so far. field - what it does: desc_input - Simple text input desc_proper - calc value; Proper ( desc_input ) desc_CAPS - calc value; Substitute ( desc_proper_step ; "Ada" ; "ADA" ) It is working, takes the text from/to: maNy ada unitS Many Ada Units Many ADA Units This is what I want, but how do I add more options? I.E, IBM, CVS, EOA, etc. thanks Link to comment Share on other sites More sharing options...
Lee Smith Posted July 21, 2009 Share Posted July 21, 2009 attach a copy of your file so that we can see the fields and calculations. Lee Link to comment Share on other sites More sharing options...
innodes Posted July 21, 2009 Author Share Posted July 21, 2009 (edited) A partial list of options to check: "Ada" to "ADA" "Adw" to "ADW" "Aec" to "AEC" "Amb" to "AMB" "Efh" to "EFH" "Bi " to "BI " "BJ's" to "BJ's" "Pms" to "PMS" Thanks, the file is attached, I did it here using calc fields. Would there be any advantage if I did it in a script instead? proper_check.zip Edited July 21, 2009 by Guest added question Link to comment Share on other sites More sharing options...
Søren Dyhr Posted July 21, 2009 Share Posted July 21, 2009 Agnès and Debi have toyed with this approach for quite a while: http://www.briandunning.com/cf/899 And it can be used like I show it in the attached template. --sd twowaystreat.zip Link to comment Share on other sites More sharing options...
Lee Smith Posted July 21, 2009 Share Posted July 21, 2009 Maybe something like this will do what you want proper_checklws.fp7.zip Link to comment Share on other sites More sharing options...
innodes Posted July 22, 2009 Author Share Posted July 22, 2009 That looks like it will do the trick. Thank you both! Link to comment Share on other sites More sharing options...
innodes Posted July 24, 2009 Author Share Posted July 24, 2009 I ended up taking this idea and changing it to a script. I can now call it from multiple layouts as needed. thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 5390 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 accountSign in
Already have an account? Sign in here.
Sign In Now