To check which elements are not necessary I have to compare if two items of an array (adata) previously loaded are the same in the archive.
If in the archive a record has the contents of two fields that are not equal to the items of aData must be deleted.
I made this test but it not found that I wish
Code: Select all
Function Trova_tariffe_inutili(cDir,adata)
Local oTariffe
Local n
Local cIdElemento
Local cSettore
Local lyes:= .f.
Local atemp:={}
xbrowser aData
For n= 1 to Len(adata)
cIdElemento:= aData [n][2]
cSettore := aData [n][4]
oTariffe:=TDatabase():Open( , cDir+"TARIFFE", "DBFCDX", .T. )
oTariffe:SetOrder( 1 )
oTariffe:GoTop()
Do while .not. oTariffe:eof()
IF oTariffe:Tasettore==cSettore .and. oTariffe:TaElemento=cIdElemento
else
aadd(atemp,{oTariffe:TaElemento,oTariffe:Tasettore} )
Endif
oTariffe:skip()
Enddo
oTariffe:close()
cSettore:=""
next
xbrowser atemp
return nil
on archive Tariffe.dbf I have these records
so the procedure must search only the two records
because tasettore = "I" and tasettore ="F" on adata not exit
How I can resolve it ?