Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Do not understand INDEX ON
Message
From
04/02/1999 13:23:58
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00183833
Message ID:
00183980
Views:
26
>Using vfp 6.0.
>
>Want to add an index to a shared network table. Put the following code in the app right before I display the table in a listbox:
>
>index on upper(f_descrip) tag f_udescrip of qm_list ascending
>
>I tested, my client tested, everything seemed to be fine. Now, 2 weeks later, I get a message that qm_list must be open exclusive to add an index. I have never opened qm_list exclusive but the message got me thinking (danger...danger).
>
>Opened qm_list in the command window (not exclusive). Added the f_udescrip index (exactly like the statement above). Looked at the properties and f_udescrip was there. Closed qm_list. Opened qm_list. f_udescrip is not in the properties. Tried to "SET ORDER TO f_udescrip". Got a variable not found (also used several variations of the SET ORDER, none worked). Tried to add the f_udescrip index and got the message that it already exists. Now f_udescrip is in the properties list and I can SET ORDER TO.
>
>1) Does "INDEX ON ... OF" add a permanent index to the CDX? If it does, why is my new index not in the properties list box until I try to add it again?
>
>thanks - brenda

When you say Index... tag ... of SomeOtherCdxFile, you actually create a non-structural index, which is not automatically opened when you USE the table. Also, you may be getting into sharing issues if your users may be adding tags to that index file (the SomeOtherCdxFile.cdx). Depending on what you want to achieve, you may have several strategies:

- If this is a temporary index, then assign it a temporary name - like your temp dir plus sys(3); make sure you erase it afterwards. This is what I often do with cursors. Though, with cursors I don't have to take care of deleting these indexes after use; with tables, you have to do it yourself, so you better save the cdx's filename into a variable so you know its name when it comes to deleting, else you may end up with lots of dangling .cdx files which may eventually eat up significant diskspace.

- If this index is permanent, then make sure it's created once and opened each time records may be added/edited, so it gets updated. If it isn't updated, once you reopen it (with either Use < table > Index SomeOtherCdxFile or with Set Index To SomeOtherCdxFile) you may get the "index doesn't match database file" or "record out of range" errors.

The moment you issue Index... tag ... of SomeOtherCdxFile command, the SomeOtherCdxFile.cdx is created if it doesn't exist; if it exists, Fox expects you to have the rights to add tags to it, which means you can't open it shared. If you're adding tags to it, then it's a temporary one.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform