KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Auto Increment
PRODUCT: 4D | VERSION: 11.2 | PLATFORM: Mac & Win
Published On: October 15, 2008

4D v11 SQL Release 2 has a new field property to automatically generate a unique ID for records. The field with this property gets incremented every time a record is created in the table. It is managed by the 4D engine and it cannot be entered or modified in any way, by the user or programmatically. Attempting to modify it will generate an error.

Numbers assigned to a field marked with Autoincrement are permanent and never get reused, even when records get deleted. If a number is generated by a transaction that gets cancelled, it is not reused either.

Fields that accept this property can be Integer, Long Integer and Integer 64. The SQL attribute is AUTO_INCREMENT and it can be specified using the SQL language.

To set a field to Autoincrement, use the Inspector of the Structure editor.