Jump to content
Sign in to follow this  
innodes

find and replace within text string

Recommended Posts

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,

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 by Guest
ps

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

attach a copy of your file so that we can see the fields and calculations.

Lee

Share this post


Link to post
Share on other sites

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 by Guest
added question

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

I ended up taking this idea and changing it to a script. I can now call it from multiple layouts as needed.

thanks again.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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