Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Want to first and last string in ax 2012

(0) ShareShare
ReportReport
Posted on by 145

Hello Everyone,

Kindly help me I want below result in name field , How would I get.

I want first and last string compulsary and then first letter from second string, Some Example I have given as show below.

Name in the system

Result

Andrew CUSHION

Andrew CUSHION

Andrew Dean CUSHION

Andrew D CUSHION

Andrew Dean Gerald CUSHION

Andrew D CUSHION

Andrew Dean Gerald Arnold CUSHION

Andrew D CUSHION

  • Suggested answer
    Microsoft Profile Picture
    on at
    RE: Want to first and last string in ax 2012

    you can try to use the SQL keyword: split .

  • Suggested answer
    nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: Want to first and last string in ax 2012

    If you look at the standard system and how names are handled, there are separate fields for first, middle and last names. Please follow this same approach in your functionality.

    Then it's also very easy to achieve the result that you need:

    1) Take the value from FirstName field

    2) Take first character from MiddleName field

    3) Take the value from LastName field.

  • Martin Dráb Profile Picture
    231,947 Most Valuable Professional on at
    RE: Want to first and last string in ax 2012

    Your problem is caused by a wrong data model. You're violating the first normal form by not having atomic values in the name. Consider fixing the model, rather than building workarounds in code.

    If you can't fix the model, take the string and split it to words, e.g. by strSplit(name, ' '). Then take the first and last ones and if the number of words is higher than 2, take the second word and extract the first character by subStr().

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,274 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,947 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans