Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Tip o' the Day
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00361872
Message ID:
00362001
Views:
17
Try it on a cursor created with a SELECT command. I also use it on a view that I have opened as read-only in the DE.

select * from mytable into cursor crsTemp nofilter

>I've never seen that error. I can do:
>
>
>USE myview NODATA
>INDEX ON KeyID TAG KeyID
>INDEX ON KeyDesc TAG KeyDesc
>=REQUERY('myView')
>
>and this works fine as well.
>
>
>>The point I tried to make was you get the first index with no problem, but you get the READ ONLY error when creating more than 1 tag. This tip avoids that problem.
>>
>>>All I do is the following:
>>>
>>>USE myview NODATA
>>>INDEX ON KeyID TAG KeyID
>>>=REQUERY('myView')
>>>
>>>and this works fine.
>>>
>>>Note the NODATA in the USE. I find indexing an empty view and then requerying is faster than indexing a view with data.
>>>
>>>>I am doing this in VFP 6 SP 3. Your results may vary in earlier versions.
>>>>
>>>>How to overcome those view and cursor indexing blues. Do the following on any cursor or view that is not table buffered. You can switch back to table buffering after creating the CDX.
>>>>use my_local_or_remote_view
>>>>index on KeyID tag KeyID of addbs(getenv('temp')) + 'AnyName'
>>>>index on Descript tag Descript of addbs(getenv('temp')) + 'AnyName'
>>>>Create as many index tags as you want and get NO READ-ONLY ERRORS! As a bonus, when you close the view, the temporary CDX file is removed also. As for coming up with a name for the CDX name, you can use sys(3) or some other variation of creating a temp. You no longer have to do the USE DBF() AGAIN IN 0 trick.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform