Problem to save a value

Problem to save a value

Postby Silvio.Falconi » Thu Jan 03, 2019 6: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: Select all  Expand view
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 November 2023 - January 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: 6824
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem to save a value

Postby nageswaragunupudi » Fri Jan 04, 2019 8: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: Select all  Expand view

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
nageswaragunupudi
 
Posts: 10280
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem to save a value

Postby Silvio.Falconi » Fri Jan 04, 2019 4: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 November 2023 - January 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: 6824
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem to save a value

Postby Silvio.Falconi » Fri Jan 04, 2019 7:41 pm

Nages
do you saw my email ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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: 6824
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 30 guests