Groups > dBase > Getting Started with dBase > Re: filter with logical field




Re: filter with logical field

Re: filter with logical field
Sat, 08 Mar 2008 11:26:41 -080
Dirk Cardoen wrote:
> Goodday
> 
> try to filter on a logical field  y or n with beginflter and applyfilter()
> 
> when, I filteron *****************[field1].value =  true ,no problem
> but when I filter on ********************[fiels1]  =  false;  I only get 4

> rows on my grid
> 
> I use the same button
> 
> function notusedBUTTON_onClick
>       form.rowset.clearfilter()
>       form.rowset.beginfilter() //08032008
>       form.rowset.fields["choice"].value=[true]//08032008
>       form.rowset.applyfilter()
>     with(form.notusedbutton)
>      onclick = class :: showallbutton_onclick
>       text = "used"
>      endwith
>    return
> 
>    function showallBUTTON_onClick
>    //  form.rowset.first()
>     with(form.notusedbutton)
>      onclick =class :: notusedbutton_onclick
>       text = "not used"
>        form.rowset.clearfilter()
>        form.rowset.beginfilter() //08032008
>        form.rowset.fields["choice"].value= [false]
//false//08032008
>        form.rowset.applyfilter()
>     endwith
>    return
> 
> what's the missing link ?

Most likely the trap that gets a lot of folk with dBF7 tables -- is the 
value in the field that is not true actually set to false? It may be null.

You can also shorten the code above ... since you're setting a new 
filter, you don't need the clearFilter(); since you're only working with 
one field, you don't need the beginFilter() and applyFilter():

replace these lines:

         form.rowset.clearfilter()
         form.rowset.beginfilter() //08032008
         form.rowset.fields["choice"].value= [false]
//false//08032008
         form.rowset.applyfilter()

with:

         form.rowset.filter := [choice <> true]

By telling it "not true" it selects those that are "false"
and those 
that are null (empty).

Ken

-- 
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
Post Reply
filter with logical field
Sat, 8 Mar 2008 20:13:43 +0100
Goodday

try to filter on a logical field  y or n with beginflter and applyfilter()

when, I filteron *****************[field1].value =  true ,no problem
but when I filter on ********************[fiels1]  =  false;  I only get 4 
rows on my grid

I use the same button

function notusedBUTTON_onClick
      form.rowset.clearfilter()
      form.rowset.beginfilter() //08032008
      form.rowset.fields["choice"].value=[true]//08032008
      form.rowset.applyfilter()
    with(form.notusedbutton)
     onclick = class :: showallbutton_onclick
      text = "used"
     endwith
   return

   function showallBUTTON_onClick
   //  form.rowset.first()
    with(form.notusedbutton)
     onclick =class :: notusedbutton_onclick
      text = "not used"
       form.rowset.clearfilter()
       form.rowset.beginfilter() //08032008
       form.rowset.fields["choice"].value= [false] //false//08032008
       form.rowset.applyfilter()
    endwith
   return

what's the missing link ?
when I use, to try, another field , toggling with the button the different 
filtres are working


regards

Dirk,







Post Reply
Re: filter with logical field
Sat, 8 Mar 2008 20:44:03 +0100
Hello Ken

  simpler couldn't be

  thanks,

Dirk,



"Ken Mayer [dBVIPS]" <dbase@_nospam_goldenstag.net> schreef in
bericht 
news:w1F7RUVgIHA.1748@news-server...
> Dirk Cardoen wrote:
>> Goodday
>>
>> try to filter on a logical field  y or n with beginflter and 
>> applyfilter()
>>
>> when, I filteron *****************[field1].value =  true ,no problem
>> but when I filter on ********************[fiels1]  =  false;  I only
get 
>> 4 rows on my grid
>>
>> I use the same button
>>
>> function notusedBUTTON_onClick
>>       form.rowset.clearfilter()
>>       form.rowset.beginfilter() //08032008
>>       form.rowset.fields["choice"].value=[true]//08032008
>>       form.rowset.applyfilter()
>>     with(form.notusedbutton)
>>      onclick = class :: showallbutton_onclick
>>       text = "used"
>>      endwith
>>    return
>>
>>    function showallBUTTON_onClick
>>    //  form.rowset.first()
>>     with(form.notusedbutton)
>>      onclick =class :: notusedbutton_onclick
>>       text = "not used"
>>        form.rowset.clearfilter()
>>        form.rowset.beginfilter() //08032008
>>        form.rowset.fields["choice"].value= [false]
//false//08032008
>>        form.rowset.applyfilter()
>>     endwith
>>    return
>>
>> what's the missing link ?
>
> Most likely the trap that gets a lot of folk with dBF7 tables -- is the 
> value in the field that is not true actually set to false? It may be null.
>
> You can also shorten the code above ... since you're setting a new filter,

> you don't need the clearFilter(); since you're only working with one 
> field, you don't need the beginFilter() and applyFilter():
>
> replace these lines:
>
>         form.rowset.clearfilter()
>         form.rowset.beginfilter() //08032008
>         form.rowset.fields["choice"].value= [false]
//false//08032008
>         form.rowset.applyfilter()
>
> with:
>
>         form.rowset.filter := [choice <> true]
>
> By telling it "not true" it selects those that are
"false" and those that 
> are null (empty).
>
> Ken
>
> -- 
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase/dBASEBooks.htm
> http://www.goldenstag.net/dbase 

Post Reply
Re: filter with logical field
Sun, 9 Mar 2008 17:28:53 +0100
Hello,

this is working on dbase but not on runtime
 form.rowset.filter=[choice=true]
does show the whole table activ and non activ , altough should showing the 
non activ mentioned adresses
form.rowset.filter=[choice<>true]
does only show the as active mentioned adresses

is this a bug

on the same form i have 20 different categories, filtering by categorie no 
prblem


function activBOX_onChange

       form.rowset.indexname ="countrycode"
      do case
       case this.value ="Non active"
        form.rowset.clearfilter()
        form.rowset.filter=[choice=true]
        form.rowset.first()
       case this.value = "Active"
        form.rowset.clearfilter()
        form.rowset.filter=[choice<>true]
        form.rowset.first()
       otherwise
        form.rowset.clearfilter()
      endcase
    return
"Dirk Cardoen" <dfcc@skynet.be> schreef in bericht 
news:$SFDINVgIHA.1748@news-server...
> Goodday
>
> try to filter on a logical field  y or n with beginflter and applyfilter()
>
> when, I filteron *****************[field1].value =  true ,no problem
> but when I filter on ********************[fiels1]  =  false;  I only get 4

> rows on my grid
>
> I use the same button
>
> function notusedBUTTON_onClick
>      form.rowset.clearfilter()
>      form.rowset.beginfilter() //08032008
>      form.rowset.fields["choice"].value=[true]//08032008
>      form.rowset.applyfilter()
>    with(form.notusedbutton)
>     onclick = class :: showallbutton_onclick
>      text = "used"
>     endwith
>   return
>
>   function showallBUTTON_onClick
>   //  form.rowset.first()
>    with(form.notusedbutton)
>     onclick =class :: notusedbutton_onclick
>      text = "not used"
>       form.rowset.clearfilter()
>       form.rowset.beginfilter() //08032008
>       form.rowset.fields["choice"].value= [false]
//false//08032008
>       form.rowset.applyfilter()
>    endwith
>   return
>
> what's the missing link ?
> when I use, to try, another field , toggling with the button the different

> filtres are working
>
>
> regards
>
> Dirk,
>
>
>
>
>
>
>
> 

Post Reply
about | contact