If you need to create records and do not want duplicated values for one field, you can index this field and check the Unique value check box. However, you'll have no control over this because 4D will generate an error which you cannot intercept. If you want to prevent 4D from generating this error, you can create a unique value field another way.
1. Use the 'Find Index key' command. This command is simple and fast. 4D will not load the record but will just try to find the value in the index table.
see: https://ftp.4d.com/aci_Technical_notes/ACIDOC/CMU/CMU00653.HTM
2. If your criteria are more complicated, you can still use other 4D commands such as SET QUERY DESTINATION and QUERY commands. The purpose is to set the destination to something other than the current selection, perform your query and check the result. By doing this, you'll be able to check the integrity without losing your current selection or current record.
SET QUERY DESTINATION(Into variable;vResult)
QUERY([Table];Field="ABC")
If (vResult # 0)
` A record already exists
Else
` A record does not exist
End if
SET QUERY DESTINATION(Into current selection)
see: https://ftp.4d.com/aci_Technical_notes/ACIDOC/CMU/CMU00396.HTM