Tech Tip: 4D reports duplicates in field declared as unique
PRODUCT: 4D | VERSION: 15 R3/R4/R5, v16 | PLATFORM: Mac & Win
Published On: November 8, 2016
Beginning with 4D v15 R3, the way to detect duplicates in fields declared as unique has been enhanced. Users of v15 R3, v15 R4, v15 R5 and v16 now have the means to know which fields contain duplicate dataa.
What’s new?
- More information is provided when duplicates are detected in unique fields:
- When using the MSC or a command such as VERIFY DATA FILE, resulting logs now contain the names of the offending tables and fields, as well as each duplicated value.
- During data entry, the "Duplicated key" error dialog box now contains the name of the offending table and field, as well as the duplicated value.
- The GET LAST ERROR STACK command also contains detailed information on any duplicates.
- When 4D opens a data file, if an index needs to be built (or rebuilt), duplicates are now automatically detected in the associated field(s) declared as unique. In this case, a specific warning dialog box is displayed before database opening, providing the user with the information needed to identify and remove duplicates:
All the offending fields are now displayed in an error message or in the log.
Duplicates can be reported through 2 different ways:
- when 4D needs to create indexes on a database with offending fields.
- during an MSC Verify scan.
Index creation
In this case, an error is displayed with the list of offending fields.MSC Verify scan
The log file contains the list of offending fields as shown below.For more details, please take a look at the 4D v15 R3 Upgrade manual.