How to generate sequential numbers for each new record in the database?

I have an application page responsible for generating new quotes. How can I ensure that each budget made has an identification number starting from number 1?

This would be: budget n°1 … budget n°2 … and so on

You can apply a :count operator (to count the number of existing quotes in the DB) and +1 to it.

uaaaal, thank you very much my friend, I was already able to apply what you told me

Mega-thread regarding this issue^

Using a count operator works in most cases. However its not 100% reliable if multiple entries can be made at once. It can become a problem if you scale.

I generally don’t advise using sequential numbers, firstly because of the reliability issue, and secondly because there is no need to provide end-customers insight about how many quotes you are making. A randomly generated serial code is generally a better/easier option.

1 Like