Problem to save a value

Post Reply
User avatar
Silvio.Falconi
Posts: 7164
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 2 times

Problem to save a value

Post 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 ?
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
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: Problem to save a value

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 7164
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 2 times

Re: Problem to save a value

Post by Silvio.Falconi »

I saw it
I tried it as I wrote you.
There are Problems as I wrote you.
Regards,
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
User avatar
Silvio.Falconi
Posts: 7164
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 2 times

Re: Problem to save a value

Post by Silvio.Falconi »

Nages
do you saw my email ?
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
Post Reply