Formatting option of autoincrement fields

offer the possibility to choose a number of digits so autoincrement 1 could be displayed with a number of zeros, ie,

- 2 digits : "1" is displayed "01"

- 3 digits : "1" is displayed "001"

etc.

It would offer a better visual consitency of IDs where autoincrements are used to create article codes, invoice numbers etc.

Hi,

Since reading the above post (looking for a leading zeros solution myself), I think I may now have found a simpler approach, at least certainly in the context of how I am using the data. I am probably not be the first to have come up with this, but thought I would mention it here anyway, in case it proves useful to someone.

I wanted an auto-increment, 5 digit reference number field, starting from a number of my choice and retaining leading zeros. Let's say I wanted the references to start from 00100 and I know that they will never exceed 99999. Below are the fields I added to my table to achieve this. There is no requirement to use a Conditional Rule with this approach, it is done purely at the table/field level:

'Number' - Auto Increment Field

'StartNumber' - Equation Field - {Number} + 100100

'Reference' - Text Formula - Right ({StartNumber},5)

Using the 'Right' function within the Text Formula field simply converts the number to a text string and chops off the column at the front of the number which represents the the hundred thousands units, thus creating a 5 digit number (as text) with leading zeros.

Cheers Steve

Nicolas, I used your solution but it does not work until you add the entry, then update the entry. The first time it is saved it gets logged with the number field as null. If you update it, then it recalculates.\

Will experiment some more.

Thanks for the suggestion Nicolas. Talking to the client, he would like a timestamp for the numerals (this will always result in a unique text combo), but I can’t do that until the text formatting functions are implemented in Knack (e.g. to strip out the punctuation: ideally I’d like full access to the components of a date so I could use yymmddhhmm as one number if needed). Any idea of timescales as to when this will be implemented?

Would be good to mix this with the useful Text Combo functionality as well, so an ID can be generated to follow certain rules with a sequence number to ensure uniqueness where necessary.