Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Increment alphanumeric characters

Posted on by 250
Hello, 
I have a custom requirement where I need to increment a combination of characters (0-9, then following 9 it should go from A-Z) for a custom field
Example : 01, 02...09, 0A, 0B..., 0Z, 10,11...19, 1A...etc.
Can anyone give me an insight how this could be implemented please?
  • Jason0810M Profile Picture
    Jason0810M 250 on at
    Increment alphanumeric characters
    Thanks Andre,
    I have managed to implement my custom logic using the two methods numRemoveFormatV2 and numInsertFormatV2 from the NumberSeq class. I have passed the format based if the character is a number or not (using str2NumOK method to differentiate between the two cases) and it works perfectly fine.
  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 288,584 Super User on at
    Increment alphanumeric characters
    Hi Jason,
     
    The NumberSeq class has a feature to increment letters. You can have a look at this class to get an example.
  • Suggested answer
    Kevin Xia Profile Picture
    Kevin Xia Microsoft Employee on at
    Increment alphanumeric characters
    Hi,
    First of all, your requirements involve custom development, and secondly, the part about the hundredth is an example i given to help you refine the logic in this area. Think the range of characters going from 0 to 9 then A to Z as a cycle. As another example, 00 means the first number of the first cycle, 01 means the second number of the first cycle, and 11 means the second number of the second cycle. These two examples will help you write custom code for the relevant logic.
    Best regards,
    Kevin
  • Jason0810M Profile Picture
    Jason0810M 250 on at
    Increment alphanumeric characters
    Hello Kevin,
     
    I did not understand the part about the hundredth.
    Actually the numbers should go from 00 to ZZ, with the range of characters going from 0 to 9 then A to Z.
  • Suggested answer
    Kevin Xia Profile Picture
    Kevin Xia Microsoft Employee on at
    Increment alphanumeric characters
    Hi,
    From your logic point of view, the code that implements this logic is not complicated:
    Take the second character, 0-9, a-z as a cycle, that is, 36 characters as a cycle; Suppose there are a hundred such fields, then the hundredth should be, 100 divided by 36 equals 2 remainder 28, which means that the hundredth is in the 28th position of the third loop, then the first character corresponds to 2, and the second character corresponds to R, that is, the value of the hundredth digit is 2R.
    I don't know if I explained it like that, do you understand?
    Best regards,
    Kevin

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans