Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reindexing VFP tables automatically within code 2

Status
Not open for further replies.

yoprogramo

Programmer
Apr 5, 1999
2
0
0
US
I used a little procedure called foxfix to reindex my tables in Ver 2.6. My problem is when I try this in Visual 5.0, I get an error "ffix4_50.fll not found". I have tried locating this file with no success. Does this file exist somewhere out there ? Or is there an easier, more direct way to do this reindexing within code in Visual 5.0 without using such files ?<br>
Thank you for any light anyone can shine on this issue.<br>
(partial code follows)<br>
* establish version<br>
DO CASE<br>
CASE '2.0'$VERS(1)<br>
cFixVer = "FFIX3_20.PLB"<br>
WAIT WINDOW 'IF YOU HAVE VISUAL FOXPRO TABLES ALSO - RUN IN VISUAL FOXPRO'<br>
CASE '2.5'$VERS(1) .OR. '2.6'$VERS(1)<br>
IF 'WIN'$UPPER(VERS(1))<br>
cFixVer = "FFIX4_25.FLL"<br>
ELSE<br>
cFixVer = "FFIX4_25.PLB"<br>
ENDIF<br>
FUNC2='FIXVFP'<br>
CASE '3.0'$VERS(1)<br>
cFixVer = "FFIX4_30.FLL" && or FOXFIX4<br>
FUNC2='FIX26'<br>
CASE '5.0'$VERS(1)<br>
cFixVer = "FFIX4_50.FLL"<br>
FUNC2='FIX26' <br>
OTHERWISE<br>
WAIT "Version Not supported" WINDOW<br>
CANCEL<br>
ENDCASE<br>

 
There is a way to reindex tables in VFP5 directly but uses code. I wrote a utility to analyze a given directory of tables and extract the indexes on them and write the code to do the reindexing and packing the tables at the same time. Since that code is long on fault tolerance and error handling I will not include it all here. There are several functions which are core to making it work. Below is the CASE statement which makes it work. What this code does is extract the existing indexes on a table and write the 'code line' to a file which can then be run to accomplish the reindexing. <br>
<br>
DO WHILE !EMPTY(KEY(mNDXcnt))<br>
DO CASE<br>
CASE UNIQUE(mNDXcnt) = .T. .AND. DESCENDING(mNDXcnt) = .T.<br>
? 'INDEX ON ' + KEY(mNDXcnt) + ' TAG ' + TAG(mNDXcnt)+" UNIQUE DESCENDING"<br>
CASE UNIQUE(mNDXcnt) = .T.<br>
? 'INDEX ON ' + KEY(mNDXcnt) + ' TAG ' + TAG(mNDXcnt)+" UNIQUE"<br>
CASE DESCENDING(mNDXcnt) = .T.<br>
? 'INDEX ON ' + KEY(mNDXcnt) + ' TAG ' + TAG(mNDXcnt) +" DESCENDING"<br>
OTHERWISE<br>
? 'INDEX ON ' + KEY(mNDXcnt) + ' TAG ' + TAG(mNDXcnt)<br>
ENDCASE<br>
<br>
IF EMPTY(SYS(2021,mNDXcnt)) = .F.<br>
?? " FOR "+SYS(2021,mNDXcnt)<br>
ENDIF<br>
<br>
mNDXcnt = mNDXcnt + 1<br>
<br>
ENDDO
 
Thank you. I'm going to try your suggestion.<br>

 
Podes usar la aplicacion GENDBC.prg que se encuentra en la carpeta "tools" para crear la base completa con todos los indices.<br>

 
If you would like to Index your data more effectively, check into stonefield database kit. re-indexing via fox commands is not nearly as effective as stonefield database kit. not only does it index, it has a wide variety of safety features in it to protect your data against file corruption.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top