Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

COPY INDEXES, COPY TAG

These two commands let you convert between stand-alone IDX files and compound indexes. They seem most useful when converting an older application or when you need to maintain compatibility with other Xbase varieties.

Usage

COPY INDEXES IndexesToCopy | ALL [ TO CDXName ]
COPY TAG TagToCopy [ OF ContainingCDX ] TO IndexName

COPY INDEXES copies one or more IDX indexes into a single compound index file. By default, the result is the structural index for the table, but you can specify a different CDX file. Each new tag is named for the IDX file where it originated. Use ALL to copy all open IDX indexes.

COPY TAG takes a single tag and makes a stand-alone IDX for it. You need the OF clause only when you have multiple tags with the same name and you want to copy one that’s not from the structural CDX.

We haven’t used COPY INDEXES since we were converting FoxBase and FoxPro 1.x applications to FoxPro 2.0. We’ve never used COPY TAG.

Example

USE Customer
COPY TAG Company_Na TO MyComp && Create a stand-alone MYCOMP.IDX
COPY TAG Customer_I to Id     && Create a stand-alone ID.IDX
* re-open with the IDXs
USE Customer INDEX MyComp,id
COPY INDEXES ALL TO MoreTags  && Create a new CDX

See Also

Copy File, Index, Set Index, Set Order