Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Vitaly Sokol
  Where is Vitaly Sokol?
 Dana Point
 California - United States
 Vitaly Sokol
 To: Manisha Sathe
  Where is Manisha Sathe?
 Manisha Sathe
Subject: ReindexTables [code modification]
Thread ID: 36926 Message ID: 58754 # Views: 1 # Ratings: 0
Version: Visual FoxPro 8 Category: Databases, Tables and SQL Server
Date: Thursday, December 30, 2004 7:11:14 PM         

Thanks Mike Shea, Jr for his excellent table re-index procedure.

I modified the INDEX ON to include the possibility for type CANDIDATE or UNIQUE.
Type REGULAR must be filtered and set to an empty string since it is not a valid attribute parameter.

* Use the tag info to re-index the tables.
FOR lnTagRow = 1 TO lnTagCount
lcName = aTags[lnTagRow,1]
lcType = aTags[lnTagRow,2]
*** Exclude type REGULAR since not allowed as attribute parameter
lcType = IIF(lcType == 'REGULAR', '', lcType)
lcKey = aTags[lnTagRow,3]
lcOrder = aTags[lnTagRow,5]
INDEX ON &lcKey. TAG &lcName. &lcOrder. &lcType.

Also better to use a named expression rather than macro expansion for the table name reference.

lcDbf = aTables[lnRow,1]

Note that this routine should not be used for tables contained in a database that have persistent relationships since they are destroyes, as is the associated table index for the database.


Pack Reindex problem Posted by Manisha Sathe @ 2/5/2004 10:52:59 AM
RE: Pack Reindex problem Posted by Mike Shea, Jr @ 2/5/2004 2:52:27 PM
RE: Pack Reindex problem Posted by Manisha Sathe @ 2/6/2004 1:57:34 AM
ReindexTables [code modification] Posted by Vitaly Sokol @ 12/30/2004 7:11:14 PM