and I make an filter with some paramters
sample : I check if field month(DATA) is the selected
It not make error of Invalid filter but not execute the filter why ?
- Code: Select all Expand view
#include "fivewin.ch"
FUNCTION Main()
RddSetDefault( "DBFCDX" )
SetHandleCount( 100 )
SET DATE FORMAT "dd-mm-yyyy"
SET DELETED ON
SET CENTURY ON
SET EPOCH TO year( date() ) - 20
SET MULTIPLE OFF
testfilter ()
RETURN nil
Function testfilter()
local aContMesi:= {.f.,.F.,.f.,.f.,.f.,.f.,.f.,.f.,.f.,.t.,.t.,.t.}
local cFilter:='"'
local oConteggio
// mesi
If aContmesi[1]=.t.
nMese:=1
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[2]=.t.
nMese:=2
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[3]=.t.
nMese:=3
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[4]=.t.
nMese:=4
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[5]=.t.
nMese:=5
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[6]=.t.
nMese:=6
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[1]=.t.
nMese:=1
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[7]=.t.
nMese:=7
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[8]=.t.
nMese:=8
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[9]=.t.
nMese:=9
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[10]=.t.
nMese:=10
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[11]=.t.
nMese:=11
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
cFilter += " .and. "
Endif
If aContmesi[12]=.t.
nMese:=12
cFilter += " Month(FIELD->data) =='"+alltrim(str(nMese))+"'"
Endif
cFilter+= '"'
?cFilter
oConteggio:=TDatabase():Open( , "Lotto", "DBFCDX", .T. )
oConteggio:setorder(1)
oConteggio:setFilter(cFilter)
oConteggio:gotop()
// xbrowser oConteggio
nRecords:=oConteggio:Reccount()
oConteggio:close()
msginfo(nrecords)
return nil
I tried with Month(FIELD->data) and Month(data) but not execute the filter
Any solution pls