FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour To Nages: Record deleted but make error also RESOLVED
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
To Nages: Record deleted but make error also RESOLVED
Posted: Wed Nov 22, 2023 09:34 AM
Now the record is deleted on archive but when save the array on dbf make error

the error
Code (fw): Select all Collapse
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 (fw): Select all Collapse
      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 (fw): Select all Collapse
AEval( aDataForm, { |a| a[ 1 ] := oRec:codRep } )
         AEval( aDataForm, { |a,i| a[ 29 ] := strzero(i,5) } )
save on archive ( here make the error )
Code (fw): Select all Collapse
oDbfMod:FW_SaveArrayToDBF( aDataForm,cItemFlds,,.t. )
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: To Nages: Record deleted but make error also
Posted: Wed Nov 22, 2023 10:05 AM
this morning I corrected with
Code (fw): Select all Collapse
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 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: To Nages: Record deleted but make error also
Posted: Wed Nov 22, 2023 02: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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: To Nages: Record deleted but make error also
Posted: Wed Nov 22, 2023 06: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 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