This topic is locked
[SOLVED]

 Prevent duplicate values in composite key

5/27/2020 7:07:56 AM
PHPRunner General questions
S
Sitaraman author

Hi,
Is there a way to prevent duplicate values in add/edit pages while using composite keys in database? The duplicate check should be on the basis of key combination instead of checking each key individually.
Thanks,

Sitaraman S

Sergey Kornilov admin 5/27/2020

Sure, you can do that manually in BeforeAdd event by executing the corresponding SQL query like:

select * from tablename where key1=value1 and key2=value2


If this query returns data that means it is not unique.