Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Index Type & Order
Message
De
03/07/2000 06:09:50
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00387677
Message ID:
00387682
Vues:
16
>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

Thank a lot Jess!
How about the:
- order (ASCENDING/DESCENDING)
- index type (Regular, Primary, Unique, Candidate)
- and the filter expression/condition (ex. "!EMPTY(name)")
Waiting for your reply...
eric
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform