>If I create a cursor:
>select Field1, field2, field3... from MyTable into cursor MyCursor
>and then I do (to MyCursor):
>index on field1 tag T1
>... this works, but if I then do
>index on field2 tag T2
>It fails, with a message that a temp file is read-only (I suppose it's referring to the CDX file that is temporarily created).
>I've tried deleting the tag, doing a "close indexes", etc. But I cannot figure out how to work around this, and it seems you lose a lot of efficiency if you have make the cursor itself ReadWrite just so you can index the cursor with more than 1 tag.
>What's the solution? Thank very much.
This is a bug.
- the primary cause is a wrong implementation of readonly
in VFP.
- the specific error is produced when VFP tries to write on the file dbf
the structural CDX flag.
With a not structural cdx or idx you can add many tags,
but you cannot do a reindex ( another effect of the wrong implementation of readonly )
CREATE CURSOR MyTable (field1 I)
select Field1 from MyTable into cursor MyCursor
INDEX ON FIELD1 TAG T1 OF cdx1
INDEX ON FIELD1+1 TAG T2 OF cdx1
INDEX ON FIELD1+2 TAG T3 OF cdx1
? TAGCOUNT()
REINDEX