FM - Sorting Titles

This is easy enough, but is there a standard way of creating a sort field for Titles.  It seems it would involve accounting for "The", "A", and "An" beginning the title and placing it at the end using the Left and Middle functions, but wanted to make sure I wasn't missing anything.  Thanks.
LVL 2
rvfowler2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will LovingPresident, Dedication Technologies, Inc.Commented:
You probably want to use Leftwords(), Rightwords() and MIddlewords() rather than Left(), Right() and Middle(), it would be simpler. I suspect there is a nice custom function out there that someone has done covering all the bases but I don't see one in a quick search. One way to set it up would be:

Case(
Leftwords( Title ; 1 ) = "A" or  
Leftwords( Title ; 1 ) = "An" or
Leftwords( Title ; 1 ) = "The" ; 
Rightwords( Title ; Wordcount( Title ) - 1 ) & ", " & Leftwords( Title ; 1 ) 
)

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rvfowler2Author Commented:
Thanks.  Small alteration is to adde the default at the end so the field won't be blank in case of no beginning article in the title.

Case(
Leftwords( Title ; 1 ) = "A" or  
Leftwords( Title ; 1 ) = "An" or
Leftwords( Title ; 1 ) = "The" ;
Rightwords( Title ; Wordcount( Title ) - 1 ) & ", " & Leftwords( Title ; 1 )  ;
Title
)
Will LovingPresident, Dedication Technologies, Inc.Commented:
Yes, I did leave that out, good catch.
historychefCommented:
willmcn's calculation will do what you want. However, here's a small point: Don't make the sort field a calculation field: instead, make it a text field, then add willmcn's expression as an initial calculated value. This permits you to override that field manually for rare cases where you want to strip something other than one of the three articles. For example, you may want to sort "Das Kapital" under "K" instead of "D", or a title such as "... and the Band Played On" under either "a" or "B", but not under "...".

Just a thought.
rvfowler2Author Commented:
Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FileMaker Pro

From novice to tech pro — start learning today.