Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Uniqueness of index PRIMARY is violated
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Uniqueness of index PRIMARY is violated
Miscellaneous
Thread ID:
00144393
Message ID:
00144393
Views:
92
Obviously I have an index named PRIMARY, which is my primary index.
I get the message when I'm trying to INSERT records into my table...
MergeList.dbf
FileName (Character 200)
Source (Character 30)
Received (DATETIME)

My primary index, "PRIMARY", is defined as:
LEFT(ALLTRIM(filename),RAT("\",ALLTRIM(filename)))+RIGHT(ALLTRIM(filename),11)+SUBSTR(ALLTRIM(filename),RAT("\",ALLTRIM(filename))+1,1)

The reason I'm doing this is becuase my file names belong in pairs and this way I can display them as pairs.

Basically, it takes file names like
\DEVELOP\OFAX2\data\date\October061998\C1001012.TXT
\DEVELOP\OFAX2\data\date\October061998\R1001012.TXT

and turns them into
\DEVELOP\OFAX2\data\date\October061998\1001012.TXTC
\DEVELOP\OFAX2\data\date\October061998\1001012.TXTR

What I don't understand is why I'm getting this message. I can insert the first record fine (of course), but as I continue I get this message and what I'm inserting is new, unique information.

Here's my code:
* get a list of the C*.txt and R*.txt files in the cSourceDirectory
* add these to the MergeList table with Source = "FDLE"
* and received = today's date and time
* cBaseDirectory is the starting directory of my app
* cSourceDirectory is "Download" ....not that it really matters for this question.
* I've tried this with the Table and with this updateable view
* the view is the same as the table...all fields updatable...key is FileName
*
IF adir(aDir_Info, cBaseDirectory+"data\"+cSourceDirectory+"\*.txt") > 0
FOR nRow = 1 to ALEN( aDir_Info, 1)
INSERT INTO vMergeList2 ;
(FileName, ;
Source, ;
Received) ;
VALUES ;
(cBaseDirectory+"data\date\"+cDestinationDirectory +"\"+ aDir_Info[ nRow, 1], ;
cSupplier, ;
DATETIME())
ENDFOR
ENDIF
Next
Reply
Map
View

Click here to load this message in the networking platform