Tech Tip: Reading the AUTOINCREMENT and AUTOGENERATE field attributes via SQL
PRODUCT: 4D | VERSION: 13.4 | PLATFORM: Mac & Win
Published On: December 26, 2013
Starting with 4D v13.4 the developer now has additional access to read field properties via SQL. These field properties are exposed via the _USER_COLUMNS system table and do not exist in previous version of 4D v13.
- AUTOGENERATE is the boolean field within the _USER_COLUMNS system table representing whether or not the Column is set to autoamtically generate UUIDs. This would be True when the field is of type Alpha and in the UUID Format with 'Auto UUID' enabled in the field property list.
Here is an example that finds all Fields that have 'Auto UUID' enabled and returns an array of the field names and the table names:ARRAY TEXT(cName_at;0)
ARRAY TEXT(tName_at;0)
Begin SQL
SELECT COLUMN_NAME, TABLE_NAME
FROM _USER_COLUMNS
WHERE AUTOGENERATE = TRUE
into :cName_at, :tName_at;
End SQL - AUTOINCREMENT is the boolean field within the _USER_COLUMNS system table representing whether or not the Column is set to automatically increment. This would be True when the field is of type Integer, Long Integer, or Integer 64 bits and with 'Autoincrement' enabled within the field property list.
Here is an example that finds all Fields that have 'Autoincrement' enabled and returns an array of the field names and the table names:ARRAY TEXT(cName_at;0)
ARRAY TEXT(tName_at;0)
Begin SQL
SELECT COLUMN_NAME, TABLE_NAME
FROM _USER_COLUMNS
WHERE AUTOINCREMENT = TRUE
into :cName_at, :tName_at;
End SQL