Page 1 of 1

Problem to save a value

Posted: Thu Jan 03, 2019 6:00 pm
by Silvio.Falconi
I must order ( display order ) an archive , the problem is I cannot use dbzap or delete record because I use that archive in share mode then if I delete each record it not run because I not recreate the index because I open the dbf in share mode

I use a field "ORDINE" where I save the n position

to move a record from a position to another I first create an array from archive

aArray:= SE->( FW_DbfToArray("id,name,breve,price,image,struttura,unit,a4,pos,multiple,islock,ordine" ) )

then in a dialog I change the position of item of this array with functions SwapUpArray and SwapDwArray I found in this forum

then I must save the new position on array with

For n= 1 to Len(aArray)
aArray[n][12]:=n
next


Now I must save on archivi se.dbf

Code: Select all | Expand

SELECT SE
dbzap
 SE->( FW_ArrayToDBF( aArray, "id,name,breve,price,image,struttura,unit,a4,pos,multiple,islock,ordine" ) )
                       SE->( DBGOTOP() )


but I cannot use dbzap because I use se.dbf in share mode , so how I can resolve it to save the aarray into se.dbf ?

Re: Problem to save a value

Posted: Fri Jan 04, 2019 8:25 am
by nageswaragunupudi
At present FW_ArrayToDbf(...) only appends records. For this reason, you need to Zap the dbf. In FWH 19.01, we added a new 4th parameter lOverWrite. If this parameter is set to .T., it overwrites the existing data from the current record. Using this enhancement you do not need to zap the dbf.

This is the sample code.

Code: Select all | Expand


cFieldList  := "id,name,breve,price,image,struttura,unit,a4,pos,multiple,islock,ordine"
aArray      := SE->( FW_DbfToArray( cFieldList ) )

//
// BROWSE aArray AND DO ALL MODIFICATIONS TO aArray
//

SE->( DBGOTOP() )
SE->( FW_ArrayToDBF( aArray, cFieldList, nil, .T. ) ) // Overwrite existing data
 


I am sending revised dbfunc2.prg containing the enhanced function to you by private mail. Include that prg in your link script and you can use the enhanced functionality now.

Re: Problem to save a value

Posted: Fri Jan 04, 2019 4:19 pm
by Silvio.Falconi
I saw it
I tried it as I wrote you.
There are Problems as I wrote you.
Regards,

Re: Problem to save a value

Posted: Fri Jan 04, 2019 7:41 pm
by Silvio.Falconi
Nages
do you saw my email ?