Problem with oBrowse:aDeleted

Problem with oBrowse:aDeleted

Postby Silvio.Falconi » Mon Nov 20, 2023 12:36 pm

To delete a record on Array I use this

function del_row( oBrowse )
if ! Empty( oBrowse:aArrayData )
ADel( oBrowse:aArrayData, oBrowse:nArrayAt, .t. )
oBrowse:Refresh()
endif

xbrowser oBrowse:aDeleted <------
return nil

it delete the row but then when I need oBrowse:aDeleted I have the empty array

How it possible ?
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with oBrowse:aDeleted

Postby nageswaragunupudi » Mon Nov 20, 2023 7:09 pm

Use
Code: Select all  Expand view  RUN
oBrw:Delete()

to delete rows. Please do not use your own functions to delete.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10655
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem with oBrowse:aDeleted

Postby Silvio.Falconi » Tue Nov 21, 2023 9:04 am

nageswaragunupudi wrote:Use
Code: Select all  Expand view  RUN
oBrw:Delete()

to delete rows. Please do not use your own functions to delete.


Yes it delete the record but then re-save on archive

There's probably something I don't understand

I have two dbf

Report.dbf (oDbf)
Formati.dbf ( oDbfMod) have 30 fields +1 for recno()

at first for editing I take a record on Report.dbf

Code: Select all  Expand view  RUN
oRecord := oDbf:record()


create am array from another archive

Code: Select all  Expand view  RUN
 aDataForm := oDbfMod:DbfToArray( cItemFlds, { ||FIELD->codRep == cCode_Tmp  } )


and work aDataform on Xbrowse


When I go to save I made
Code: Select all  Expand view  RUN

      // save oDbf Report.dbf

       // delete rows
       
          if ! Empty( oBrowse:aDeleted )
            AEval( oBrowse:aDeleted, { |a| a[ 31 ] := -a[ 31 ] } )
            oDbfMod:SaveArrayToDBF( cItemFlds, oBrowse:aDeleted )
         endif

         AEval( aDataForm, { |a| a[ 1 ] := oRec:codRep } )
         AEval( aDataForm, { |a,i| a[ 29 ] := strzero(i,5) } )
         oDbfMod:SaveArrayToDBF( cItemFlds, aDataForm )

          //Salva Report.dbf ok
        oRec:Save()
 

I tried also with

Code: Select all  Expand view  RUN
oDbfMod:ArrayToDBF( aDataForm ,  cItemFlds,, .t., .t. )


append a record empty on oDbf
not delete the record on oDbfMod
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 17 guests