I have an ID field that automatically increments by 1 when a new record is added. Rather than use the numeric ID as is, I would like to convert it to a 6 character string made up of 0-9A-Z (no lowercase letters) with the following format:
A00000
The numbers should increment from 0-9 then A-Z.
Examples
If I were to encode the number 7 for example, it should return:
A00007
If I encode the number 13 it should return:
A0000D
If I encode the number 36 it should return:
A00010
Hopefully this makes sense. Any help would be greatly appreciated.
Suggestion: Add 604661760 to the integer value. That’s the base-10 value of
A00000, interpreted as a base-36 number ( = 10 * 36 ^ 5 ).Then encode the result in base 36.
Depending on your data range, you might want to promote the
intto alongbefore adding 604661760.