FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Recall records with FW_ArrayToDBF
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Recall records with FW_ArrayToDBF
Posted: Tue Feb 12, 2019 09:22 AM
I have to re-insert data from an array onto a data store. I state I opened the dbf with Tdatabase.

These are many records.

For example, as a first configuration I want to try with 450 records.

Since I opened and indexed with the "For! Deleted ()" clause I should first delete them all and then use the "FW_ArrayToDBF" function to reinsert them all.

recalling the deleted records but I do not know how to do it.

Nages had written to me privately that he sang me as I could recall a deleted record

To save my record I made :

the function of save record first go to function Controllo to see if there are errors on array

FUNCTION SaveConfig(lMessaggio)
Local nY, nX
Local lErrore := .f.
Local nprogress := 0
Local aTempDbf:={}

IF lMessaggio
lErrore:= Controllo()
Endif

IF !lErrore
Ut_ResetMeter( oProgressDlg, nprogress ) // reset the control Meter


// to simulate db_zap I must erase all records

oSpiaggia:Gotop()
Do While .not. oSpiaggia:eof()
oSpiaggia:delete()
oSpiaggia:skip()
EndDo


oSpiaggia:Gotop()

// save on in un array temporaneo

For nY := 1 to TOTY
For nX := 1 To TOTX
nRow:=nX
nCol:=nY
cElemento:=aData[nY,nX]
cLibero:=strzero(recno(),5)


//----------------------------------------------------------------------------------//
Now I save all data into a temporaney array aTempDbf I have info data in different other arrays
//-------------------------------------------------------------------------------------//

For n= 1 to Len(aElementi)
IF aData[nY,nX] == aElementi[n][3]
IF aElementi[n][6] == TRUE //attivo
nCamera:= Iif(!empty(aNumeri[nY,nX]),aNumeri[nY,nX],0)
cSettore:=Iif(!empty( aSettori[nY,nX]),aSettori[nY,nX],"")
cDesc:=aElementi[n][4]
lactive:= TRUE
else
cDesc:=aElementi[n][4]
ENDIF
elseif aData[nY,nX] =="X"
cDesc:="spazio vuoto"
Endif
next n

AaDD( aTempDbf,{nCamera,nRow,nCol,cElemento,cDesc,,strzero(recno(),5),cSettore,lActive})

next nX
next nY







//----------------------------------------------------------------------------------//
Now I must save on dbf from array with recal delete
//-------------------------------------------------------------------------------------//
cFieldList:="camera,x,y,Id,Desc,Stato,Libero1,settore,active"

oSpiaggia:FW_ArrayToDBF(aTempDbf, cfieldlist,,.t., .t., )

but it make error, add to dbf but not recall the records



the red records are deleted()
I use 19.01 fwh
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Recall records with FW_ArrayToDBF
Posted: Tue Feb 12, 2019 09:41 AM

There have been subsequent improvements.
You get the final version when you download FWH 1901.

I would also suggest you wait for sample programs that we are going to post in the forums, demonstrating the use.

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Recall records with FW_ArrayToDBF
Posted: Tue Feb 12, 2019 09:47 AM

please revise my message

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Recall records with FW_ArrayToDBF
Posted: Tue Feb 12, 2019 10:27 AM

oDbf:SetOrder( 0 )
oDbf:GoTop()
oDbf:ArrayToDBF( aData, cFieldList, nil, .t., .t. )

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion