Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Index Type & Order
Message
 
 
To
03/07/2000 05:41:02
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00387677
Message ID:
00387678
Views:
13
>I'm creating a program that will extract all the index information of a file. I used TAG() to determine the index name, KEY() for the index expresion.
>Is there a function that returns order (ASCENDING or DESCENDING), and a function that returns the index type (Regular, Primary, Candidate, Unique), and also the Filter Expression.
>Thanks in advance!

You look into this program Eric. It list down index expression of your table.
**************************************
**
**	Function	:	GetIndexExpr
**	Purpose		:	Creates list of index expression of a table
**	Params		:	cTable (character) - table name
**	Programmer	:	Jess S. Banaga
**	Date Started:	03/02/2000
**	Modified	:	03/20/2000 - to accomodate multi-table structure printing
**
**	Syntax		:	Old - GetIndexExpr('tablename.dbf')
**					New - GetIndexExpr()
**
**************************************

** Get table name
gcTable = GETFILE('DBF','Create Index Expression File','Create File')
IF !EMPTY(gcTable)
    ** invoke procedure to get index expression
    DO GetExpr WITH SUBSTR(gcTable,1,RAT('.',gctable))
ELSE
    ** specify directory folder to scan
    gcDIR = GETDIR(FULLPATH(''),'Directory Table')

    IF !EMPTY(gcDIR)
	
	** assign table list to array variable
	
	nCntr = ADIR(cTableFile,'*.DBF')
	
	** scan array variable
	
        FOR i = 1 TO nCntr
	    gcTable = cTableFile(i,1)
			
	    ** invoke procedure to get index expression
	    DO GetExpr WITH gcTable
	ENDFOR
    ENDIF
ENDIF
CLOSE ALL
RETURN
**************************************
**	End fo program GetIndexExpr
**	Date Finished	: 03/02/2000
**************************************

**************************************
**	Procedure	:	GetExpr
**	Purpose		:	Creates Text File
**	Params		:	cTable - Table Name
**************************************
PROCEDURE GetExpr ( cTable )

cFile = ctable+'.txt'
SET DEVICE TO FILE &cFile
@PROW(),00 SAY 'TABLE NAME	: '+cTable
@PROW(),00 SAY '  '
@PROW(),00 SAY 'INDEX TAG NAME       INDEX EXPRESSION' 
@PROW(),00 SAY '-------------------- -------------------------------------------------'
FOR i = 1 TO TAGCOUNT()

    ** GET index tab
    cIndexTag = ALLT(TAG(ctable,i,ctable))
    
    ** GET INDEX EXPRESSION
    cIndexExpr = ALLT(SYS(14,i,ctable))

    @PROW(),00 SAY cIndexTag 
    @PROW(),20 SAY cIndexExpr

ENDFOR

** Look the output now
modi comm (ctable) noedit
USE IN (cTable)
SET DEVICE TO SCREEN
HTH
JESS S. BANAGA
Project Leader - SDD division
...shifting from VFP to C#.Net

CHARISMA simply means: "Be more concerned about making others feel good about themselves than you are in making them feel good about you."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform