Page 1 of 1

filter on tdabase

Posted: Wed Jan 23, 2019 10:41 am
by Silvio.Falconi
I have a dbf open with tdatabase a with filter and I wish add another filter
But the function FiltraBase make error because probable not run the setfilter command


and I made

I open two area of Tariffe.dbf

1. oTariffeOneDay
2. oTariffeMulti

have the filter

cFilter1 := 'FIELD->GIORNI=1' //oneday
cFilter2 := 'FIELD->GIORNI>1' //from 2 to x

oTariffeOneDay:= TTariffe():new()
oTariffeOneDay:setFilter( cFilter1)
oTariffeOneDay:gotop()

oTariffeMultipli:= TTariffe():new()
oTariffeMultipli:setFilter(cFilter2)
oTariffeMultipli:gotop()

Now I wish change the filter selecting the combobox

on the combobox I insert


@ 36,75 COMBOBOX cFilter ITEMS ArrTranspose( aListini )[ 1] ;
SIZE 100,400 PIXEL OF oDlgTariffe;
ON CHANGE FiltraBase(oBrw1,cfilter,aListini,cFilter1,oTariffeOneDay)


Function FiltraBase(oBrw1,cfilter,aListini,oTariffeOneDay)
// make a filter on otariffeoneday
oTariffeOneDay:setfilter(trim(oTariffeOneDay:idlistino)==Search_cod(cFilter,alistini) .AND. oTariffeOneDay:GIORNI=1 )
oTariffeOneDay:gotop()
oBrw1:refresh()
return nil
//-------------------------------------------------------------------------------------------------------------------------------------------------//
Function Search_cod(cFilter,alistini)
Local nAt := AScan( alistini, { |a| a[ 1 ] == cFilter } )
Local cCode:="01" //primo record
If nAt>0
cCode:= alistini[nAt][2]
endif
return cCode

Re: filter on tdabase

Posted: Wed Jan 23, 2019 5:16 pm
by James Bott
Try:

cX := Search_cod(cFilter,aListini)

oTariffeOneDay:setFilter( "IDListNo == " + cX + " .and. giorni=1" )

Re: filter on tdabase

Posted: Wed Jan 23, 2019 8:26 pm
by Silvio.Falconi
Application
===========
Path and name: C:\Work\Errori\tariffe_james\tariffe.Exe (32 bits)
Size: 4,210,176 bytes
Compiler version: Harbour 3.2.0dev (r1703231115)
FiveWin version: FWH 18.12
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 7 secs
Error occurred at: 23-01-2019, 21:26:14
Error description: Error BASE/1004 No exported method: SETFILTER
Args:
[ 1] = C FIELD->GIORNI=1
[ 2] = C IDListiNo == 02 .and. giorni=1