Increment integer

0
Good Afternoon, Is it possible to reset an auto generated number back to 1 each time a new record association is created? I have an entity called request type and a one to many link to another entity called request sequence. there is one request type that can have multi sequences, these sequences should always start at 1 when a new request type is created. Is that possible? Regards, Matt Smith
asked
3 answers
2

You cannot set a autonumber back to 0. When you create a record using a "$RequestSteps/Sequence + 1" (when not using autonumber), you could end up in double sequence numbers when a second create has been fired, and the first record hasn't been committed. If the create is part of a big transaction, the double numbers would be more likely when more transactions are running at the same time.

When you're using an autonumber, you could save of the last sequencenumber in (for example in a separate entity) on when you press the "reset" button. when you create a new record, you should save the substracted number in a separate attribute, so you can always calculate the resulting sequence number (current sequencenumber - saved number) and you can keep track after which reset, the record has been created.

answered
0

This is not possible using the standard autonumber, this autonumber is attached to a sequence in the database and cannot have duplicate values for rows in the same table.

You could however create some increasing number of your own, but how hard this is will depend on your concurrency requirements, i.e. are there a lot of users creating these entities simultaneously.

answered
0

 

 

 

Based on the above method u should increment your integer value…. Here I create one attribute called Value with default value 1.. While clicking button it call this microflow. Here also simple things just create object with these attribute and change object accordingly like Value+1..

answered