web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Answered

remove special characters from a string

(0) ShareShare
ReportReport
Posted on by 280

The users want the item number stripped of all special characters as the search name in the product master.  I have looked on the web, but I have not really found the solution that I am looking for to be able to do this.  Does anyone have a suggestion on how to remove all blanks and special characters?

Thank you

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,917 Super User 2025 Season 2 on at

    It is possible to do a minor customization, but why do the users want to have the search name stripped? What functionality do they expect further or is it for searching purposes only?

    Shakespeare once quoted: "What's in a name?". My quote: "What's in a number?"

    As you don't give an example I cannot see the need at this moment.

  • Jane L. Adney Profile Picture
    280 on at

    The user wants to be able to put dashes or periods in the number, but not have those special characters in the search name.  They have this in the old system and expect it in the new system.  I just need to know how to make them happy.

  • dolee Profile Picture
    11,279 on at

    What about modifying NameAlias before a record is inserted into InventTable?

  • Dick Wenning Profile Picture
    8,705 Moderator on at

    in the worse case , write a new method on the class SysQueryRangeUtil

    see also

    technet.microsoft.com/.../aa569937.aspx

  • Verified answer
    Jane L. Adney Profile Picture
    280 on at

    One of my co-workers figured out the solution that works great.

    Static str stripStrings(str _InputString)

    {

       str message;

       message =  System.Text.RegularExpressions.Regex::Replace(_InputString, @"[\W_]", "");

       return message;

    }

  • Suggested answer
    Mark Prouty Profile Picture
    1,312 on at

    Native function strAlpha(inputString) seems to be the same as Jane's solution below.

  • Community Member Profile Picture
    on at

    HI,

    If you want to delete the special characters from string, you can use "strAlpha" function. This copies only the alphanumeric characters from a string.

    Ex : info(strFmt("%1", strAlpha("?a*b!!!!cD123.")));

    results in "abcD123".

    I hope this helps :)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans