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.

Featured Replies

I have in an FMPro12 table a field containing data which is always text, each word separated by dashes (they are parts of URL's).

Some entries will be a single word (so no dashes); others may be 2, 3 or more words (always separated by dashes).

There will never be a 'space' in the field's data.

 

Typical contents might be for example:

entertainment

european-holidays

womens-jewelry-and-accessories

 

Can some kind person give me the Calculation I can use to:

(1) replace each 'dash' with a 'space'

(2) then uppercase the first letter only of each word (ie, initial capitals)

(3) and replace any occurrence of the word 'and' with '&'

 

Many thanks in anticipation.

let(
[
 
_string = "womens-jewelry-and-accessories" ;
_cleanString = Substitute ( _string ; [ "-" ; " " ] ; [ " and " ; " & " ] ) ;
_properString = Proper ( _cleanString )
 
];
 
 
_properString
 
 
)

Use the substitute function. If your field = This A How To & This & That.

 

Proper (Substitute ( yourField ; 

[“-“; “ “ ];

[“and” ; “&”] 

)

)

I noticed that Wim is up early today and posted a Let, here is another way using the  Substitute function.

 

Lee

  • Author

Thanks, Lee.  That worked perfectly.

 

And thanks for your reply Wim, although I must admit I found Lee's explanation easier to follow!

 

Thanks to you both, and to FMForums for coming up trumps again!

 

Philip

Hi Philip,

 

The Let Function is easier to follow than the “if” or “Case” most of the time.

 

I changed some of the words of Wim’s calculation to see if it would help you understand it better

 

Let ( [

text = yourField ; //equals the _string by Wim.

cleanString = Substitute ( text ; [ "-" ; " " ] ; [ " and " ; " & " ] ) ; // equals the same as my Substitute

newText = Proper ( cleanString ) //Proper is a Function in FileMaker.

] ;  

 

newText

using the let makes it somewhat easier to troubleshoot, by asking of the various part if it does not seem to work.  So instead of returning "newText" you could return "cleanString" and see what it did....

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.