Is that possible to create auto-number fields?

Hi guys,

do you know if it’s possible to create unique auto-number fields? For instance, I want to use a template US-{0000} where:

  • US- will be fixed piece
  • {0000} will start from 0001 and be incremented for every new record (random unique number also works)

If you just need a unique id, can you use the entity public id (and concatenate with the prefix text as needed)?

It’s a bit ugly, but if you need the leading zeroes, this formula should get you what you want:

"US-{" + if(Length([Public Id])=1,"0000",if(Length([Public Id])=2,"0000",if(Length([Public Id])=3,"00",if(Length([Public Id])=4,"0","")))) + [Public Id] + "}"

You can use this as the entity name, or as a standard formula field.

1 Like

Thank you @Chr1sG In general your idea is good, it covers our needs. But the question is still open is it possible to generate automatic number. Seems like it’s a new feature request.

1 Like

Given that the public ID starts at 1, automatically increments each time a new entity is created, and is never re-used, it seems to have the characteristics you are looking for, unless I’m missing something?
I’m interested to hear what is the need that is not covered?
(apart from an easier way of zero-padding :wink: )

Slightly less ugly:

"US-{" + Right( "0000" + [Public Id], 4) + "}"

(not tested)

3 Likes

haha, thanks.
you can tell I’m not a natural born coder :roll_eyes: