FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem to save a value
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Problem to save a value
Posted: Thu Jan 03, 2019 06:00 PM
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 (fw): Select all Collapse
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem to save a value
Posted: Fri Jan 04, 2019 08:25 AM
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 (fw): Select all Collapse
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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem to save a value
Posted: Fri Jan 04, 2019 04:19 PM

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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem to save a value
Posted: Fri Jan 04, 2019 07:41 PM

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

Continue the discussion