Page 1 of 1

Problem with Filter and Tdatabase

Posted: Wed Nov 06, 2024 12:38 pm
by Silvio.Falconi
Please I have this function

Code: Select all | Expand

#include "fivewin.ch"

request dbfcdx

Function test 
     local oDbf
     local cdbfPath:= cFilePath(GetModuleFileName( GetInstance() ))  + "Data\"
     local nYear:= year(date())
     local   cFilter:= "LTRIM(STR(YEAR(FIELD->DATA)))= '" + ltrim(str(nyear)) + "'"
   

  oDbf:= TDatabase():Open( , cdbfPath+"LOTTO", "DBFCDX", .T. )
  oDbf:setorder(1)
  oDbf:GoTop()

          xbrowser odbf

        oDbf:SetFilter(cFilter)
        oDbf:GoTop()

     xbrowser odbf
return nil 
the index 1 is on DTOS(DATA)+CONCORSO

before the filter I see all archive

Image

the filter seems good

Image

After the filter it not show any records , why ?

Re: Problem with Filter and Tdatabase

Posted: Wed Nov 06, 2024 1:25 pm
by MarcoBoschi
Silvio,
have you some records in which the year of field named "data" is 2024
In the screenshot I see 1971

Bye

Re: Problem with Filter and Tdatabase

Posted: Wed Nov 06, 2024 1:29 pm
by Silvio.Falconi
MarcoBoschi wrote:Silvio,
have you some records in which the year of field named "data" is 2024
In the screenshot I see 1971

Bye
yes that is the beginning of the archive, I tried to make a filter in emagdbu


Image

Re: Problem with Filter and Tdatabase

Posted: Wed Nov 06, 2024 8:42 pm
by Silvio.Falconi
It's strange because in the test I did, that is, in the procedure in a small dialog, everything works perfectly, but when I create an object class with all the functions of the procedure it doesn't work, that is, it doesn't find the data, there's definitely an error somewhere that I can't find.

this is basically what i'm doing, it seems complex but it's not

Image