If you delete a cdx index file, is there a quick easy way to recreate it or
do you have to redefine all of the indexes?

Re: cdx files by Craig

Craig
Wed Oct 05 09:22:34 CDT 2005

You have to redefine all the tags. BTW, this is the recommended way to
rebuild an index instead of REINDEX. Be aware that if you DELETE TAG or
delete the CDX, the persistent relations tied to them will be deleted.

--
Craig Berntson
MCSD, Visual FoxPro MVP
www.craigberntson.com
Salt Lake City Fox User Group
www.slcfox.org
www.foxcentral.net


"CKurek" <CKurek@discussions.microsoft.com> wrote in message
news:597DBED3-5F0D-425B-9944-B2CB5A4EC0CA@microsoft.com...
> If you delete a cdx index file, is there a quick easy way to recreate it
> or
> do you have to redefine all of the indexes?



Re: cdx files by CKurek

CKurek
Wed Oct 05 09:41:09 CDT 2005

WHat I am actually trying to do is trap for Error #114 Index Does not match
the table. Delete the index file and recreate the index.

In my trap I was going to delete the cdx and recreate the indexes. I am
just looking for an easy way to do this. I know that it is almost always the
same table that has the issues.

"Craig Berntson" wrote:

> You have to redefine all the tags. BTW, this is the recommended way to
> rebuild an index instead of REINDEX. Be aware that if you DELETE TAG or
> delete the CDX, the persistent relations tied to them will be deleted.
>
> --
> Craig Berntson
> MCSD, Visual FoxPro MVP
> www.craigberntson.com
> Salt Lake City Fox User Group
> www.slcfox.org
> www.foxcentral.net
>
>
> "CKurek" <CKurek@discussions.microsoft.com> wrote in message
> news:597DBED3-5F0D-425B-9944-B2CB5A4EC0CA@microsoft.com...
> > If you delete a cdx index file, is there a quick easy way to recreate it
> > or
> > do you have to redefine all of the indexes?
>
>
>

Re: cdx files by Dan

Dan
Wed Oct 05 10:40:14 CDT 2005

An error handler is absolutely the wrong place to create indexes unless your
application is single-user. Creating an index tag requires exclusive use.

What you REALLY need to do is address whatever is causing the index
corruption.

Dan

CKurek wrote:
> WHat I am actually trying to do is trap for Error #114 Index Does not
> match the table. Delete the index file and recreate the index.
>
> In my trap I was going to delete the cdx and recreate the indexes. I
> am just looking for an easy way to do this. I know that it is almost
> always the same table that has the issues.
>
> "Craig Berntson" wrote:
>
>> You have to redefine all the tags. BTW, this is the recommended way
>> to rebuild an index instead of REINDEX. Be aware that if you DELETE
>> TAG or delete the CDX, the persistent relations tied to them will be
>> deleted.
>>
>> --
>> Craig Berntson
>> MCSD, Visual FoxPro MVP
>> www.craigberntson.com
>> Salt Lake City Fox User Group
>> www.slcfox.org
>> www.foxcentral.net
>>
>>
>> "CKurek" <CKurek@discussions.microsoft.com> wrote in message
>> news:597DBED3-5F0D-425B-9944-B2CB5A4EC0CA@microsoft.com...
>>> If you delete a cdx index file, is there a quick easy way to
>>> recreate it or
>>> do you have to redefine all of the indexes?



Re: cdx files by Olaf

Olaf
Wed Oct 05 10:45:41 CDT 2005

> In my trap I was going to delete the cdx and recreate the indexes. I am
> just looking for an easy way to do this. I know that it is almost always the
> same table that has the issues.

With AERROR() you should be able to determine which table threw the
error 114. Array element 4 should tell you the workaera.

Then you could:

lcDBF = DBF(nWorkarea)
SET SAFETY OFF
USE IN SELECT(nWorkarea)
ERASE (FORCEEXT(lcDBF,"cdx"))
USE (lcDBF) IN 0 EXLUSIVE
and then recreate the indexes.

You should store the indexdefinitions or simply a script you can run for each
table in a meta data table.

That's also just a draft of an idea. In a multiuser environment it's hard
to get exclusive access to a table, so this may only be a valid procedure
for single user desktop applications.

Bye, Olaf.



Re: cdx files by Cindy

Cindy
Wed Oct 05 13:03:36 CDT 2005

Hi,

If you have working index files you can use ATagInfo(), Sys(14) to get index
names and expressions and then store them in a table as Olaf suggested. Then
scan through the table and recreate them.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy_winegarden@msn.com www.cindywinegarden.com
Blog: http://spaces.msn.com/members/cindywinegarden


"CKurek" <CKurek@discussions.microsoft.com> wrote in message
news:597DBED3-5F0D-425B-9944-B2CB5A4EC0CA@microsoft.com...
> If you delete a cdx index file, is there a quick easy way to recreate it
> or
> do you have to redefine all of the indexes?