Become a Rapid Developer. Learning Path 5.4.3

0
I have performed everything exactly as the documentation guided. Here, in registrations,TrainingEvent_Registration_Overview Page, I have added a new  registration by clicking the 'new' button and gave necessary inputs, the data stored perfectly. Again, I clicked on new button in the TrainingEvent_Registration_Overview page, the Number(auto number data type) is '2', for my first record it is '1'. But this time I closed the page, instead of saving the data. Now again I re-clicked on Add button, now the Number value is '3', where I have only one record stored in the entity previously. Here, Number got increased even though I did save the record. The reason behind this is not mentioned over there.
asked
2 answers
0

Hi Sridatta,

 

Autonumber works that way, it will be increased by 1 every time you create a object. When ever you open NewEdit page it will automatically create a object. but without commit alos you create a object.

 

To resolve this issue, Use non-persistent entity to validate the object and once it is validated then create object with persistent entity of same object. This way, Autonumber only increased for commited objects.

answered
0

Hi Jilla,

 

Even though it may sound confusing, this is indeed the normal behaviour for a AutoNumber value. Every time an object is created, the AutoNumber value will increase by 1. So this happens during the creation of an object, not during the commit action. So even though you cancel your changes, it will still increase the AutoNumber next time you create a new object.

 

So if you would like to get sequential numbers/id's, the AutoNumber isn't the way to go.

 

Hope this clears things up for you.

answered