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