Format AutoNumber with leading zeros

2
Hello, as a Mendix beginner I’m wondering how to approach the following. I have an entity that should have a unique ID. For that I use an attribute of type AutoNumber. Now, when the attribute is displayed it should be displayed with leading zeros like e.g. 0000000123 (10 digits long). Haven’t found anything about leading zeros or fixed formatting, yet. Could anyone give me a tip how to approach this?   Thank you and take care!
asked
1 answers
3

You need to save the id as a new string attribute, so use the toString() function to transform your auto number to a string, and then use the StringLeftPad Java action from the community commons module to add the leading zeros.

answered