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.

Need calculation to move "The" or "A" at the front of a field to the end after a comma

Featured Replies

  • Newbies

I have a library file of books (way too many books!). The titles were entered with "The" and "A" at the beginning of the Title field, if that was part of the book's title. I would like to move these words to the end of the field after a comma and space. 

"The Name of the Rose" ==> "Name of the Rose, The"

More specifically I would like to create a calculated field, e.g. "TitleSansThe" and use a calculation to populate this field from the Title field. Can someone please point me in the right direction. I am new to calculations (and most of FMPro for that matter).

Thanks in advance.

John

PS. I searched for previous posts on this topic, but was unable to filter the 230K answers.

Try this as calculation: 

Let ( [
	title = books::title 
];
     Case ( 
       Left ( title ; 4 ) = "the " ; Middle ( title ; 5 ; 9999) & ", The"  ; 
       Left ( title ; 2 ) = "a " ; Middle ( title ; 3 ; 9999) & ", A"  ; 
     title 
  )
)

 

I would do:

Let ( 
firstWord = LeftWords ( Title ; 1 )
;
If ( firstWord = "The" or firstWord = "A" or firstWord = "An" ;
RightWords ( Title ; WordCount ( Title ) - 1 ) & ", " & firstWord ;
Title )
)

 

  • Author
  • Newbies

Thank-you Ocean West and thank-you Comment. I appreciate your answers and your time. I will try them out today.

Have a great week!

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.