Problem to Filter a dbf error on day week

Problem to Filter a dbf error on day week

Postby Silvio.Falconi » Tue Jun 07, 2022 9:30 am

I have to create a virtual archive in an array from a dbf taking into account some parameters
from year to year
what months of the year
which days of the week
what numbers of days of the month


But I have this error

Code: Select all  Expand view
Error occurred at: 07-06-2022, 11:24:44
   Error description: Error BASE/1132  Limiti superati: accesso all'array
   Args:
     [   1] = A   {.T.,.T.,.T.,.T.,.T.,.T.} length: 6
     [   2] = N   0

Stack Calls
===========
   Called from:  => (b)EVAL( 443 )
   Called from:  => DBEVAL( 0 )
   Called from: .\source\function\DBFFUNC1.PRG => FW_DBFTOARRAY( 143 )
   Called from: .\source\classes\DATABASE.PRG => TDATABASE:HB_EXECFROMARRAY( 0 )
   Called from: .\source\classes\DATABASE.PRG => TDATABASE:DBFTOARRAY( 1622 )
   Called from: Source\test.prg => CREAZIONE_ARCHIVIO_VIRTUALE( 450 )



the error refers to the days that I load from an INI file



INI FILE

Code: Select all  Expand view
[ARCHIVIO]
Mesi=111111111111
Giorni=111111
Day=1111111111111111111111111111111
Indici=111111111111110
Inizio=3914
Fine=10083
DataInizio=19460105
DataFine=20220517
 




local cGiorno := GetPvProfString(cSection, "Giorni","1111111", cIniFile)


For k=1 to 6 //len(aGiorni) LMMGVS
aadd(aCountGiorni,IIF(SubStr(cGiorno, k, 1)= "1",.t.,.f.))
next



Code: Select all  Expand view

 oConteggio:=TDatabase():Open( , cDir+"Lotto", "DBFCDX", .T. )
    oConteggio:setorder(1)


    IF nLastRecords > 0
       nInit:=oConteggio:lastrec()-nLastRecords
       nEnd:= oConteggio:lastrec()
    ENDIF
         
     oConteggio:Exec( <||
     SET FILTER TO   (  dFirst <= FIELD->DATA .AND.             ;
                        dLast >=  FIELD->DATA .AND.             ;
                        aCountMesi[ MONTH( FIELD->DATA ) ]  .AND. ;
                        aCountGiorni[ DOW( FIELD->DATA )-1 ] .AND. ;   // make error here
                        aCountDate[ DAY( FIELD->DATA ) ]   )

      return nil
      > )

      oConteggio:gotop()
      xbrowser oConteggio
      aTempDbf := oConteggio:DbfToArray()
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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem to Filter a dbf error on day week

Postby Silvio.Falconi » Tue Jun 07, 2022 9:42 am

I modify the number of day week add also Sunday

Image

Now the day are Seven


File Ini
Code: Select all  Expand view
[ARCHIVIO]
Mesi=111111111111
Giorni=0111111
Day=1111111111111111111111111111111
Indici=111111111111110
Inizio=3914
Fine=10083
DataInizio=19460105
DataFine=20220517



For k=1 to 7//len(aGiorni) DLMMGVS
aadd(aCountGiorni,IIF(SubStr(cGiorno, k, 1)= "1",.t.,.f.))
next

But I have the same error
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: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem to Filter a dbf error on day week

Postby nageswaragunupudi » Tue Jun 07, 2022 11:13 am

This is wrong:
Code: Select all  Expand view

aCountGiorni[ DOW( FIELD->DATA )-1 ]
 


If FIELD->DATA is Sunday, DOW( FIELD-> DATE ) evaluates to 1 and [ DOW[FIELD->DATA] - 1 ] evaluates to 0/
Naturally aCountGiorni[ 0 ] results in a runtime error.
This must be simple to understand.
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 92 guests