Problem with Filter and Tdatabase

Post Reply
User avatar
Silvio.Falconi
Posts: 7104
Joined: Thu Oct 18, 2012 7:17 pm

Problem with Filter and Tdatabase

Post 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 ?
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
MarcoBoschi
Posts: 1070
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: Problem with Filter and Tdatabase

Post by MarcoBoschi »

Silvio,
have you some records in which the year of field named "data" is 2024
In the screenshot I see 1971

Bye
Marco Boschi
info@marcoboschi.it
User avatar
Silvio.Falconi
Posts: 7104
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with Filter and Tdatabase

Post 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
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: 7104
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with Filter and Tdatabase

Post 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
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
Post Reply