This is a question that comes up a lot, so creating this topic to use as a reference.
Typically, there are two distinct use cases when it comes to auto-incrementing row numbers.
Use Case 1:
– We need to generate a Part Number, or an Order Number, or an Employee ID. Once the number is generated, it should never change, even if rows are deleted.
– The general approach for this use case is to maintain a static counter, use it to craft a suitably formatted ID, and increment it by one every time…
Hope this helps. Your case is a bit more complex due to the relation between model design choice & variant, but the thread above should give you enough to start.