Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

indexing a cursor 1

Status
Not open for further replies.

paulthibodaux

IS-IT--Management
Apr 4, 2002
20
US
When I create a cursor in a muti user application there is no conflict between users but if the cursor is indexed users then get a "index already exists". Can a index be created that will be user specific as in a cursor?
 
You can avoid this problem by making sure you create your cursors on the user's local system (not on the network drive). This also speeds up access to the cursor. Just set TMPFILES in your CONFIG.FPW file to the local system. (This does assume we are talking "real" cursors and not simply filtered records on the original table.)

Rick
 
HI

1. Method 1...
Create the index file using the following code.

myIndexFile = "I"+SUBSTR(SYS(2015),4)+".IDX"
INDEX ON myField TO (myIndexFile)

at the cleanup level after the closing of file.. delete the file created with code..
DELETE FILE (myIndexFile)

2. Method 2...

While creating the cursor.. create it as a DBF table..

myFile="T"+SUBSTR(SYS(2015),4)

SELECT * FROM myTable INTO DBF (myFile)... etc..
Then create the index as a TAG and .CDX way. This will create the index TAG

At the cleanup code place.. you can delete the files using code..
DELETE FILE myFile+".DBF"
DELETE FILE myFile+".CDX"

Hope this helps you :) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
HI Rick,
That is a quick solution. But what happens if the same application is run twice in the same computer? Will the error show up in that case. SO whether it is local drive or network drive.. the correct solution is to use a unique index file name.
:) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Ramani,
Theoretically there should be no problems with real cursors since VFP names any files that get written to disk with a unique file name and so the index (CDX) should be too. Where problems come in are with the "filtered" cursors - with VFP 6.0+, just add the NOFILTER clause in these cases, then all should be well.

Rick


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top