I try to create small program to see the index expression. It has 3 columns in array but it shows 4 columns in the xbrowse as picture.
What is the matter?
- Code: Select all Expand view RUN
- #include 'fivewin.ch'
Function main( cTable )
local lStart, aIndexKey, aIndex
local oDlg, oBrw, oBtn, oSay, oFont
local cPath, aDBF, n, x
Default cTable := ''
REQUEST DBFCDX, DBFFPT
cTable += iif(upper(right(cTable,4))='.DBF','','*.DBF')
cPath := curdrive()+':'+curdir()+'\'
aDBF := Directory(cPath+cTable)
if !empty(aDBF)
lStart := .T.
else
MsgWait('Table : '+cTable+' does not exist',,1)
lStart := .F.
end
if lStart
aIndexKey := {}
for n := 1 to len(aDBF)
cTable := left(aDBF[n][1],len(aDBF[n][1])-4)
if file(cPath+cTable+'.CDX')
DbUseArea( .T., 'DBFCDX', cTable, 'TMP', .T., .T. )
DbSetIndex( cTable )
aIndex := IndexInfo(cTable)
TMP->(DbCloseArea())
for x := 1 to len(aIndex)
aadd( aIndexKey, { aIndex[x][1], aIndex[x][2], aIndex[x][3] } )
next
end
next
DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14
DEFINE DIALOG oDlg FROM 0, 0 TO 500, 900 TITLE 'Index Table' PIXEL FONT oFont
oDlg:lHelpIcon := .F.
@ 2, 2 XBROWSE oBrw ARRAY aIndexKey ;
COLUMNS 1, 2, 3 ;
HEADERS 'Table', 'Tag', 'Expression' ;
COLSIZES 100, 100, 543 ;
SIZE 447, 247 ;
PIXEL ;
oDlg
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:nRowDividerStyle := LINESTYLE_LIGHTGRAY
oBrw:nColDividerStyle := LINESTYLE_LIGHTGRAY
oBrw:nHeaderHeight := 26
oBrw:nRowHeight := 24
oBrw:lHScroll := .F.
oBrw:lVScroll := .T.
oBrw:nStretchCol := STRETCHCOL_LAST
oBrw:lAllowRowSizing := .F.
oBrw:CreateFromCode()
oDlg:oClient := oBrw
ACTIVATE DIALOG oDlg CENTER
oFont:End()
end
return nil
*---------------------------*
Function IndexInfo(cTable)
local aOrders := {}
local j, n
n := OrdCount()
FOR j:=1 TO n
aadd( aOrders, { iif(j=1,cTable,''), OrdName(j) , UPPER(OrdKey(j)) } )
NEXT
Thank you in advance for any help and suggestion.