Jump 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 word in a string with a field content

Featured Replies

Hello

I have a text string serial number which has a word "model" imbedded in each serial number. I need to replace that (word) "model" within the string to a code from another field called "code". The problem is that the word "model" is sometimes in different places within the string. for example

J98(model)564790D3

K098f(model)F4FED5

In the first example it is in the 4th digit that it starts and in the second example it is in the 6th digit where it starts

BUT the field code sometimes contains 3 or 4 or 5 digits

so if the field "code" in the first record is "DCVRT" Then the first record should become

J98DCVRT564790D3

and if the field "code" in the second record is "DCKT" Then the second record should become

K098fDCKTF4FED5

Thanks

Dave

Use the "Position" function in your calculation:

Position(Ser#,"(model)",1,1)

will return the place in the serial number field where "(model)" happens -- 4 in the first case, 6 in the second. Use it within a Replace calculation to tell it where to replace the next 7 characters with Code.

-ESpringer

Hi Dave,

What determines the code to be used as the replacement for model. is it the leading characters, the number of characters before or after "(model)"? etc.

Lee

  • Author

Hi Lee

Thanks for answering, It is already defined in another field. Sometimes it is 3 or 4 or 5 characters but it is already set in the field called "code" . I would say the number of leading characters determines where it goes. In other words, "model" will be replaced by the contents of field code.

Hope that is what you are asking

thanks

Dave

I'm still confused. Maybe I haven't had enough coffee yet, but how are you going to know which records require which "Code". Or are you doing a find for each set of records for each code based on the other field?

If so, you can change "(model)" to the Code number using a simple Replace by calculated results, either manually or by script, using a calculation that looks like this:

Subsitute(YourField, "(model)", "code")

A couple of things to remember.

if "(model)" isn't in parenthesis than change the calculation to "model" and where "code" is, type in the applicable code number.

Note: Practice with this on a copy of your file, because you can't UNDO replace.

HTH

Lee

Create an account or sign in to comment

Important Information

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

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.