Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Replace Function & variable text

Featured Replies

  • Newbies

Hello, all you smartypants.

I'd be most grateful if you could help me with this one.

I'm trying to create a replace calculation based on text, but it only works if the EXACT text is the only thing in the field. In other words, it replaces "wrappers" with "softcover" but it does not replace "illustrated wrappers" or "self-wrappers" with "softcover", as I would like it to.

Can anyone tell me what to put in the calculation to make the replacement whenever the given text exits in the field even if there are other words in the field, or even if it is part of another word?

I've used nesting before, but there are so many variations It'd be a mile long!

THANK YOU!!!

The answer to your question:

Substitute( DataField , "wrappers" , "softcover" )

The question to see if I am understanding your desired outcome:

Is this a one time, Replace Field Contents (Ctrl + =) operation, acorretion via an auto-entered value, or a calculated value? The addition info will change based on the answer.

There is also the question of context, ie, wrapper would not be replaced but wrappers would. It would help to have more examples to work with and how it will be used, as Mark says. The other problem with narrowing the replacement to words-within-words is that the wrong word might be replaced. It would not happen in your example but may if other examples are presented. Depending upon the need, I might suggest using a gFrom global text and a gTo global text and a scripted approach; possibly while viewing highlight of possible words to change. If used within an auto-enter, it might make correcting the incorrectly changed words more difficult to fix. Examples of possible problems: Replace wrappers with softcover ...

Original: The wrappers were placed ...

Result: The softcover were placed ...

Original: If the wrapper is 1/4", it should be placed with the other wrappers.

Result: If the wrapper is 1/4", it should be placed with the other softcover.

So not only can the singularity mismatch, but not all of the words will be replaced which will produce illogical sentences. If you replace smaller words, the odds of replacing an incorrect one increase, ie, replace able with capable - would change enable to encapable. :crazy2:

We have a lot more questions than answers for sure. :smile2:

LaRetta

In truth, it might work best to use Perform Find/Replace. But I would still incorporate that script-step with a good view of highlighted possibilities (using a global to plug in the root word). As you applied Perform Find/Replace, the remaining highlighted words of possible matches, such as root word ending in 'ing' or 'ed', would then stand out for a second round of find/replacing if need be.

The question is not clear enough. For example, I understood it as:

Case ( PatternCount ( YourField , "wrappers" ) ; "softcover" , YourField )

  • Author
  • Newbies

Hello & thanks. OK:

My database is for my library and my field BINDING is populated with descriptions of my books bindings. I would like to dumb it down, so that the fancy bibliographic terms become simpler: either hardcover or paperback.

Therefore, I'd like for it to translate any field that contains the word "wrappers" (in any incarnation or combination, whether it's self-wrappers or decorative wrappers or wrappers in dust-jacket)to the word "Paperback."

My current replace function translates "wrappers" to "paperback" only if "wrappers" is the ONLY word in the field.

But I would like for it to work in any instance that the word "wrappers" appears in the field. So that:

self-wrappers = paperback

decorative wrappers = paperback

wrappers = paperback

wrapper = paperback

wrappersdelight = paperback

You all are great! thank you!

You could easily replace any of these rather easily:

wrappers = paperback

wrapper = paperback

wrappersdelight = paperback

With

self-wrappers = paperback

You could add in a check to see if there is a hypen and do this rather easily too.

However with text stings such as:

decorative wrappers = paperback

It may not be that easy because how do you distinguish one word as needing to be replaced verses not. Is this a list of predefined adjectives that you want to replace as part of this?

  • Author
  • Newbies

Mr. Vodka:

That's the problem. The list of pre-defined adjectives is rather long. I could enter them all (and do it in a nesting 'if' function), but I'm trying to just find a shortcut so that the entire text in any field containing the word 'wrappers' will become 'paperback' . hmmm

but I'm trying to just find a shortcut so that the entire text in any field containing the word 'wrappers' will become 'paperback'

This should have been stated earlier.

As Comment pointed out, your replace calc could be just as simple as:

Case ( PatternCount ( YourField ; "wrapper" ); "paperback"; YourField )

If you want to compensate for a cap. letter such as Wrapper, then use

Case ( PatternCount ( Lower ( YourField ) ; "wrapper" ); "paperback"; YourField )

  • Author
  • Newbies

Thanks, Mr. Vodka! I'll try that!

(Sorry it wasn't clear before, thanks for your patience, but I thought I stated it here:

"I'd like for it to translate any field that contains the word "wrappers" (in any incarnation or combination, whether it's self-wrappers or decorative wrappers or wrappers in dust-jacket)to the word "Paperback." My current replace function translates "wrappers" to "paperback" only if "wrappers" is the ONLY word in the field. But I would like for it to work in any instance that the word "wrappers" appears in the field.)

  • Author
  • Newbies

Thank you all!!!!

Problem solved.

Most gratefully yours, Piez

If you want to compensate for a cap. letter such as Wrapper, then use

Case ( PatternCount ( Lower ( YourField ) ; "wrapper" ); "paperback"; YourField )

This is not necessary, since PatternCount() is not case-sensitive.

Oops forgot. I always get the case sensitivity for PatternCount and substitute jumbled. Thanks Michael.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.