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.

GetFirstName ( FullName )

Featured Replies

Name & Parameters: [color:red][big] GetFirstName ( FullName ) [/big]

Description: Return a person's first name. Skips over titles, will also return a hyphenated first name, or a second name where the person uses his first name initial.

Sample Input:

1) Mrs. Ann-Marie Smith

2) Dr. J. Harry Morton

3) John Doe

Results:

1) Ann-Marie

2) Harry

3) John

Recursive: no

Formula:

/* CF: Returns A Contact's First Name from a Full Name

    CF:  GetFirstName

             FullName

*/



Let ( [

         name= Substitute ( FullName; "-" ; "00" ); // Needed because FM treats lots of characters as separators 

         fw= LeftWords ( name ; 1 );

         title=  Case( fw= "Mr" or fw= "Mrs" or fw= "Ms" or fw= "Miss" or fw= "Prof" or fw= "Dr"; fw; "" ); // Trap title if it exists

         start= Case( WordCount(title) ≤ 0; 1; 2); // Skip title if necessary 

         start= Case( Length( MiddleWords ( name ; start ; 1 )) ≤ 1; start+1; start) // Move over 1 if initial: returns 'Thomas' if name is 'J. Thomas Smith'

         ];



Substitute( MiddleWords ( name ; start ; 1 ); "00"; "-") // Replace with dash



) 

Required Functions:

Author(s): Steveinvegas

Date: 06/03/06

Credits:

Disclaimer:

FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.

Did you solve the problem with two first names?

  • Author

I was only interested in handling a hypenated first name, which this does.

Steve

I simply use four fields for a name - First Title, Second First, Third Middle, Fourth Last.

It reduces confusion, though this function does look like it might have some use to me anyway in terms of reparsing into the database.

Cheers,

~Genx

  • Author

Yeh, but...it takes more screen real estate and users are more likely to make mistakes by typing multiple words into 1 field. I usually (against convention) keep the full name in one field. I had a script to split things out when I needed to, but these functions make things more convenient.

Steve

Create an account or sign in to comment

Important Information

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

Account

Navigation

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.