Displaying numbers in a 6 digit format


Another unique ask today. I am storing ID numbers using count objects +1 in many different places in my software. In some of these, I need them stored as a 6 digit or 4 digit number in the front end. so 1 would be 000001 etc.

I am having trouble finding the best way to do this. Any ideas would be greatly appriciated

Thanks in Advanced


Store them as texts (either instead of, or as well as) numbers.

I did already dabble with this, how would I go from 1, 2, 3 to 000001, 000002, 000003

just add 5 zeros to the beginning of the text.

obviously, you’ll have to change the number of preceding zeros as the number get bigger (with some conditions)

or you could do something like set the text to a huge number (like 1000000000000) plus the new number (3) (to give you 1000000000003), truncated from end to 6 (to get 000003)

or just set the text to 00000, append the new number and truncate from the end.

1 Like

Thank you so much for the ideas, I will try these!

A massive thank you @adamhholmes I have utilized the truncated from end to solution and works really well

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.