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.

Substitute function working inconsistently?

Featured Replies

I'm struggling to understand an intermittent problem using the substitute function.

I have a script that works on a single record extracting data into a global text field, The script adds the item description on the first line, a list of serial numbers on the second line, and a order reference on the third line, so the final text field might look something like this.

Bds-C-Z-2-S-351/364-0.8-Ferrule

s/n 176613.176666.176619.176616.176615.176617.187934.187937.187939.187941

w/o 8220623

When I initially add the item description to the text string, I apply the Proper function to it to to ensure that the item description has a consistent look:

set field(WORKS ORDER::_gClip; Proper(WORKS ORDER::Item Description) & "¶")

I need two have two different versions of this field, one with the part number and one without. To create the one without the part number, I use the substitute() function on this text field viz:

set field[WORKS ORDER::_gClip; Substitute(Substitute(WORKS ORDER::_gClip;"¶¶";"¶");Proper(WORKS ORDER::Item Description);"")]

This works almost every time, but occasionally the substitute process does not remove the part number. When this happens, I've checked the Item description for obvious extra spaces, tab or return characters before or after the description but it seems clean.

Can anyone suggest why the substitute function might sometimes fail?

Brian

Substitute is case sensitive. I'd make it all uppercase or lowercase instead of proper case.

Also, there is no need to nest the substitutes. Instead enclose multiple substitution expressions in square brackets:

Substitute( field ; [ "something" ; "nothing" ] ; [ "gone" ; "forgotten" ] )

Or in your example:

Substitute( Lower( WORKS ORDER::_gClip ) ; [ "¶¶" ; "¶" ] ; [ Lower( WORKS ORDER::Item Description ) ; "" ] )

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.