Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Overcome the key uniqueness violated
Message
From
14/06/1998 11:22:17
 
 
To
14/06/1998 07:11:57
Tan Gay Cheong
Cybercomp Computer Services
Singapore, Singapore
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00107980
Message ID:
00108000
Views:
22
>I have a table with a candidate key.
>When I append blank, and delete it, leaving the candidate key field blank.
>
>And when I try to append another blank record, the error msg
>" Uniqueness of Index feildname is violated "
>
>What can I do to overcome this problem?
>Should I set the UNIQUE OFF or ON in the form initialise event, will it help?

Create your candidate index on field FOR !deleted(). Beware that indexes using a FOR clause are not rushmore optimizable, so if this is a large table, adding records will be slowed considerably. To get rushmore optimization in queries though, just create another identical index without the FOR clause.

FWIW, this is why I am usually very cautious about using candidate keys, and I usually take care of checking for duplicates myself in the code that adds records. Currently this has to be done with a second alias of the cursor open to search for the value, but with 6.0 INDEXSEEK() will handle this nicely.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform