Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
APPEND BLANK to cursor, CANDIDATE INDEX, index violation
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01312895
Message ID:
01312903
Views:
18
>>I'm getting some inconsistent errors that have left me confused about the situation.
>>
>>I have created a cursor and a candidate index for that cursor. The index uses two fields of the cursor. Here is the INDEX command that I am using.
>>
>>INDEX ON BINTOC(GroupID) + BINTOC(VisitID) TAG ixPrjSess CANDIDATE
>>
>>GroupID and VisitID are integer fields. The index using these two fields should be unique, thus my use of CANDIDATE.
>>
>>I use APPEND BLANK to add records to the cursor. After appending a blank record I fill in the fields with REPLACE commands.
>>
>>Some of the time I can add records with the APPEND BLANK command without any errors. Other times I get an error saying that the uniqueness of the index is violated.
>>
>>If a new index value is created when the APPEND BLANK is executed, I would expect that the index would be identical every time. Why do I not get a uniqueness violation every time?
>>
>>Thanks for your thoughts.
>>
>>Jim
>
>Is it possible you already have one empty record?
>
>As alternative, you can always use INSERT command with both values to avoid the error.

Naomi,

Thank you for your quick reply. As always, I would prefer to understand what is going on rather than use a work around.

I can always APPEND BLANK one record to the cursor without an error. I then populate that record with values, in particular with GroupID and VisitID. If GroupID = 1, I can append additional records, populating each one before appending the next one without errors. However, if GroupID = 2, I can APPEND one record. When I attempt the next APPEND BLANK it triggers the index uniqueness violation error.

What is going on?

Jim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform