Error
- Code: Select all Expand view
Time from start: 0 hours 0 mins 1 secs
Error occurred at: 04/13/23, 11:21:28
Error description: Error BASE/1068 Argument error: array access
Args:
[ 1] = U
[ 2] = N 1
Stack Calls
===========
Called from: ut_reindex.PRG => TINDICE:ORDER( 108
Line 108 DbUseArea( .F. ,"DBFCDX", ::aIdx[ i, 1 ],, .F. )
I'm using a small class to index dbf files on my app
on test I use customer.dbf
- Code: Select all Expand view
#include 'fivewin.ch'
#include "constant.ch"
#INCLUDE "DIRECTRY.CH"
REQUEST DBFCDX
*MEMVAR oApp
Function Main()
local cPathDbf:=".\data\"
TIndice():New(cPathDbf):Activate()
return nil
CLASS TIndice
DATA aIdx
DATA nIdx
DATA oDlg
DATA oFont
DATA oMeter
DATA cText
DATA oSay
DATA oAnimate
DATA oBmp
DATA oBtnok
DATA oBtnExit
DATA cPathDbf
METHOD New() CONSTRUCTOR
METHOD Activate()
METHOD Order()
END CLASS
METHOD New(cPathDbf) CLASS TIndice
//test for demo
::aIdx := { ;
{ "CUSTOMER" , { { "Upper(First)" , "First" , "Customer" } ,;
{ "Upper(Last)" , "Last" , "Customer" } ,;
{ "State" , "State" , "Customer" } } } ,;
}
// ::cPathDbf := cPathDbf
RETURN Self
METHOD Activate() CLASS TIndice
LOCAL QSelf := Self
local nBottomDlg := 10
local nRightDlg := 40
local nWd := Max( nRightDlg * DLG_CHARPIX_W, 180 )
local nHt := nBottomDlg * DLG_CHARPIX_H
::oFont:= TFont():New( "Tahoma", 0, 12,, )
DEFINE DIALOG ::oDlg SIZE nWd, nHt PIXEL TRUEPIXEL ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MINIMIZEBOX)
SET FONT TO ::oFont OF ::oDlg
@ 2,12 SAY ::oSay PROMPT ::cText SIZE 200,20 OF ::oDlg COLOR CLR_RED UPDATE
::oMeter := TProgress():New( 4.8, 2, ::oDlg, , , , .f.,, 300, 15, "", .f., .f. )
::oMeter:SetRange( 0, LEN( ::aIdx ) )
::oAnimate := TAnimate():New( 2.8, 2, ::oDlg, .t., , 200, 12)
@ 110,10 BUTTON ::oBtnOK Prompt "Conferma" SIZE 55,20 PIXEL OF ::oDlg ACTION ( ::Order() )
@ 110,95 BUTTON ::oBtnExit Prompt "Annulla" SIZE 55,20 PIXEL OF ::oDlg ACTION ( ::oDlg:End() )
ACTIVATE DIALOG ::oDlg CENTERED;
ON INIT ( QSelf:oAnimate:CopyFile(), QSelf:oAnimate:Play() )
RETURN NIL
METHOD Order() CLASS TIndice
LOCAL i
LOCAL k
LOCAL bCode
local cfor := "!Deleted()"
local bFor := "{ || " + cfor + "}"
::oBtnOk:Disable()
::oBtnExit:Disable()
*xbrowser ::aIdx
FOR i := 1 TO LEN( ::aIdx )
//dbUseArea( .t., ::cDriver, ::cFile, ::cAlias, ::lShared, ::lReadOnly )
DbUseArea( .F. ,"DBFCDX", ::aIdx[ i, 1 ],, .F. )
FOR k := 1 TO LEN( ::aIdx[ i, 2 ] )
bCode := "{ || " + ::aIdx[ i, 2, k, 1 ] + "}"
OrdCondSet(cFor,bFor,,,,, RECNO(),,,, )
OrdCreate( ::aIdx[ i, 2, k, 3 ], ::aIdx[ i, 2, k, 2 ], ::aIdx[ i, 2, k, 1 ], &bCode )
NEXT
DbCloseArea()
::oMeter:nPosition := ( ( i * 100 ) / Len( ::aIdx ) )
NEXT
::oBtnExit:Enable()
MsgInfo( "Azione terminata", "Index" )
::oDlg:End()
RETURN NIL
make error , but the procedure create the index good ...
How I can resolve ?