Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is a table bound expression?
Message
From
23/07/2002 13:40:42
 
 
To
23/07/2002 09:16:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00681586
Message ID:
00681796
Views:
29
Will-

>I have a little reindex routine which bascially does the following
>
>scan through all dbf files in a folder
>deletes the .CDX file
>A)select * from "Original" into Table temptable
>B)recreates the CDX on temptable
>C)Copy To "Original" With Cdx Type Fox2x
>D)Use In Select("temptable")
>endscan
>
What is the goal of this routine? To down-version a DBF table to Fox2X format?

I would probably go a different route of creating the Fox2X table, then once you're sure it's good, delete the original and rename the new file to the old name. I don't know if that's applicable to your goal, though.

Since the SELECT statement opens "Original", the COPY TO shouldn't be expected to work unless you've first closed Original. Again, you could just rename the TempTable files to Original after closing everything. That way you won't have any access conflicts.

Try something like the following example:
CLOSE DATABASES ALL

*!* This gives us a common table to use for the example
CREATE TABLE TestTable ( ID I )
INDEX ON ID TAG ID
USE IN TestTable
*!* ---------------------------------------------------

LOCAL ai[1], lni, lnTags, lcExpr
USE TestTable
COPY TO NewTable TYPE FOX2X
lnTags = ATAGINFO(ai,"TestTable.cdx",'TestTable') && What tags do we need to recreate?
USE NewTable
FOR lni = 1 TO lnTags
	lcExpr = ;
		"INDEX ON " + ai[lni,3] + " " +;
		"TAG " + ;
		LEFT(ai[lni,1],10)
	&lcExpr
NEXT lni
USE IN NewTable
DELETE FILE TestTable.* RECYCLE
COPY FILE NewTable.* TO Products2X.* WITH CDX
DELETE FILE NewTable.* RECYCLE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform