To Nages: Record deleted but make error also RESOLVED

To Nages: Record deleted but make error also RESOLVED

Postby Silvio.Falconi » Wed Nov 22, 2023 9:34 am

Now the record is deleted on archive but when save the array on dbf make error

the error
Code: Select all  Expand view  RUN

Error description: Error BASE/1102  Argument error: UPPER
   Args:
     [   1] = A   {"00003",4.10,11.00,17.60,0.90,.T.,0,16777215,.F.,"molto fine  ","1234567890123                ... } length: 32

Stack Calls
===========
   Called from:  => UPPER( 0 )
   Called from: .\source\function\DBFFUNC2.PRG => (b)FW_SAVEARRAYTODBF( 879 )
   Called from:  => ASCAN( 0 )
   Called from: .\source\function\DBFFUNC2.PRG => FW_SAVEARRAYTODBF( 879 )
   Called from: .\source\classes\DATABASE.PRG => TRIGHEMODULI:HB_EXECFROMARRAY( 0 )
   Called from: .\source\classes\DATABASE.PRG => TRIGHEMODULI:FW_SAVEARRAYTODBF( 1624 )
   Called from: TEST.PRG => TESTDEL( 131 )
   Called from: TEST.PRG => MAIN( 26 )



TO save a xbrowse ( with array with 31 record + "recno()") I made


Check if there are deleted records

Code: Select all  Expand view  RUN
     if ! Empty( oBrowse:aDeleted )
             AEval( oBrowse:aDeleted, { |a| a[ 32 ] := -a[ 32 ] } )
            oDbfMod:SaveArrayToDBF( cItemFlds, oBrowse:aDeleted )
         endif


save on first record the code (oRec:codRep) and save on 29 record the counter "00001"

Code: Select all  Expand view  RUN
AEval( aDataForm, { |a| a[ 1 ] := oRec:codRep } )
         AEval( aDataForm, { |a,i| a[ 29 ] := strzero(i,5) } )


save on archive ( here make the error )

Code: Select all  Expand view  RUN
oDbfMod:FW_SaveArrayToDBF( aDataForm,cItemFlds,,.t. )
Last edited by Silvio.Falconi on Wed Nov 22, 2023 8:57 pm, edited 1 time in total.
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Record deleted but make error also

Postby Silvio.Falconi » Wed Nov 22, 2023 10:05 am

this morning I corrected with
Code: Select all  Expand view  RUN
if ! Empty( oBrowse:aDeleted )
              AEval( oBrowse:aDeleted, { |a| a[ 32 ] := -a[ 32 ] } )
              oDbfMod:SaveArrayToDBF( cItemFlds, oBrowse:aDeleted )
           endif
           //save
         AEval( aDataForm, { |a| a[ 1 ] := oRec:codRep } )
         AEval( aDataForm, { |a,i| a[ 29 ] := strzero(i,5) } )
         oDbfMod:ArrayToDBF( aDataForm ,  cItemFlds,, .t., .t. )


on test seem run ok

when I put into prg make error

Error description: Error BASE/1070 Argument error: ==
Args:
[ 1] = C
[ 2] = N 0

Stack Calls
===========
Called from: .\source\function\DBFFUNC2.PRG => FW_FIELDSPUT( 986 )
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages: Record deleted but make error also

Postby nageswaragunupudi » Wed Nov 22, 2023 2:45 pm

There is no problem with oBrw:aDeleted array.

When a programmer tries to save this array or any other array to DBF it is his responsibility to match the type of the array elements with the datatypes of the corresponding fields of the DBF.
Regards

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

Re: To Nages: Record deleted but make error also

Postby Silvio.Falconi » Wed Nov 22, 2023 6:15 pm

nageswaragunupudi wrote:There is no problem with oBrw:aDeleted array.

When a programmer tries to save this array or any other array to DBF it is his responsibility to match the type of the array elements with the datatypes of the corresponding fields of the DBF.


I actually don't know why when I delete one it assigns a number in position 32, where I added the "recno" field as it is done on yunus.prg
If I add and delete, a number is not inserted
So we arrived at this conclusion which seems to work

AEval( oBrowse:aDeleted, { |a| IF(a[ 32 ] ==0, a[32] := len(oBrowse:aDeleted),nil) } )

also because the programmer checked for days the exact correspondence between fields and values in the fields and everything seemed fine except for the last field which in reality is not a field from the archive but has been added into the array
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: 7070
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 51 guests