today problem with savetodbf

Re: today problem with savetodbf

Postby Silvio.Falconi » Thu Aug 19, 2021 4:54 pm

I understood I have aItems of 18 field and citemflds of 19

How I can make to set aItems to 19 fields ?
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: today problem with savetodbf

Postby Silvio.Falconi » Thu Aug 19, 2021 4:57 pm

Otto wrote:'Silvio,

but before you can save a record you have to navigate to the recNo

METHOD GoTo( nRecNo )
or insert a new record.
METHOD Append()


Why don't you create a function, SAVE () and pass your data?
There you open your database again and save everything.
And then closes it.


For such a complicated task, this is more transparent.
And more secure. Commit, skip problems. More save in network enviroment.


Best regards,
Otto


after i can do everything, first i solve this problem

in the yunus.prg program Nages adds a field to aBlankItem

i have the array differently and i don't know how to add the field
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: today problem with savetodbf

Postby Silvio.Falconi » Thu Aug 19, 2021 5:04 pm

Perhaps I found a solution

I add on dbf Rig_Res a field recno numeric 3cr

when I add a new service I add a new field
Code: Select all  Expand view
AaDd(oBrowse:aArrayData,{ ".\bitmaps\servizio.png"  ,;
                          "01"    ,;
                          "servizio" ,;
                          1    ,;
                          9  ,;
                          9 ,;
                           ,;
                           ,;
                            ,;
                          0  ,;
                          0  ,;
                          nInvoice ,;
                          .t. ,;
                          .t.,;
                          "",;
                          "",;
                          1    ,;
                          0,0} )
 

now the fields are 19


the I save with oRigheInvoice:ArrayToDBF( aData, cItemFlds,, .t., .t. ) and seem to run
Now I must make the edit procedure
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: today problem with savetodbf

Postby Silvio.Falconi » Thu Aug 19, 2021 5:35 pm

Otto,
making the modifies this afyernoon perhaps it can run

the new record is ok
the modify record is ok

I have problems when I delete a row

on xbrowse of yunus it delete with

Code: Select all  Expand view
 :bKeyDown   := { |k| If( k == VK_DELETE, ( oBrowse:aAppend := nil, oBrowse:Delete(), 0 ), nil ) }


I insert a button at xbrowse with
Code: Select all  Expand view
WITH OBJECT oBrowse:aCols[ 12]
                      :AddBitmap({"delete.bmp","broom.png"})
                       :nBtnBmp := 1
                       :lBmpStretch     := .F.
                       :lBmpTransparent := .T.
                       :nwidth := 30
                       :nEditType := EDIT_BUTTON
                       :bEditBlock := { || oBrowse:Delete()  }
                       :nHeadBmpNo := 2
                       :cHeader := ""
                     END
 

this seem be not the same
when I save the rows
I use this
Code: Select all  Expand view

 if ! Empty( oBrowse:aDeleted )
            AEval( oBrowse:aDeleted, { |a| a[ 18 ] := -a[ 18 ] } )
             oRigheInvoice:SaveArrayToDBF( cItemFlds,oBrowse:aDeleted ) // save the delete records
          endif


If I use my method not run ok

in fact it does not delete (on dbf) the lines that I have deleted on xbrowse
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: today problem with savetodbf

Postby Silvio.Falconi » Thu Aug 19, 2021 5:43 pm

OK NOW RUN OK

Code: Select all  Expand view

if ! Empty( oBrowse:aDeleted )
            AEval( oBrowse:aDeleted, { |a| a[ 19 ] := -a[ 19 ] } )
             oRigheInvoice:SaveArrayToDBF( cItemFlds,oBrowse:aDeleted ) // save the delete records
          endif
 


I AM HAPPY
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests

cron