Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

What is the best way to separate RM00101.CUSTNAME into First and Last?

(0) ShareShare
ReportReport
Posted on by

I am return RM00101 data from from a stored procedure, and I need to get First and Last name. I could simply split the CUSTNAME by spaces but is that the best way to do it? My concern is with names that may have more than a single space separating three or more words as a full name. Should I be concerned?

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    on at
    RE: What is the best way to separate RM00101.CUSTNAME into First and Last?

    In case anyone else is looking for this, here is the code I wrote to get first and last from CUSTNAME.

    string[] nameParts = strCUSTNAME.Split(' ');

    string first=null, last=null;

    if(nameParts.Length > 2)

    last = nameParts[2];

    else if (nameParts.Length > 1)

    last = nameParts[1];

    //first name is always element 0

    if (nameParts.Length > 0)

    first = nameParts[0];

  • Mariano Gomez Profile Picture
    26,225 on at
    RE: What is the best way to separate RM00101.CUSTNAME into First and Last?

    If all you had to deal with was 2 word names, it would be very easy to do this. However, you have other things to consider:

    1. What if a customer name is First Initial Last

    2. First Middle Last

    3. What if a customer name is a company name

    4. First Initial[.] Last

    The permutations of how a name can be written is the troubling part, not the splitting of the name in itself

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Almas Mahfooz Profile Picture

Almas Mahfooz 3 User Group Leader

Featured topics

Product updates

Dynamics 365 release plans