NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Mike Grigsby on November 19, 2013, 01:01:03 PM

Title: How do I use OR and AND in a browse filter with 4 elements?
Post by: Mike Grigsby on November 19, 2013, 01:01:03 PM
I'm filtering a browse (I'm using a bit of short hand here, because I actually do this in the browse filter loop embed), but I need to evaluate if a member type is an "a" or a "m", then show records that are not disabled but have been vetted by the administrator.

So this works:

'USE:MemberType=''m'' AND USE:Vetted=''1'' AND USE:Disabled=''0'''

But I need to check two member types, and this does not work:

'USE:MemberType=''m'' OR USE:MemberType=''a'' AND USE:Vetted=''1'' AND USE:Disabled=''0'''

I can't get my head around it. I can't figure out how to isolate the OR. Thanks in advance.
Title: Re: How do I use OR and AND in a browse filter with 4 elements?
Post by: kevin plummer on November 19, 2013, 04:28:33 PM
try

'(USE:MemberType=''m'' OR USE:MemberType=''a'') AND USE:Vetted=''1'' AND USE:Disabled=''0'''
Title: Re: How do I use OR and AND in a browse filter with 4 elements?
Post by: Stu on November 20, 2013, 03:18:25 PM
Also good to make sure the fields are declared in the "View Fields" template section of the browse.
Title: Re: How do I use OR and AND in a browse filter with 4 elements?
Post by: Bruce on November 20, 2013, 09:40:15 PM
>> Also good to make sure the fields are declared in the "View Fields" template section of the browse.

actually this has no benefit. It doesn't do any harm, but fields used in the filter, or order, are not required to be in the VIEW.

cheers
Bruce
Title: Re: How do I use OR and AND in a browse filter with 4 elements?
Post by: Stu on November 21, 2013, 01:01:20 PM
Bruce,

Serious? I can distinctly remember times when, in my custom filter (embed code, not using the template), if I didn't have them in VIEW FIELDS that it wouldn't work.

So they don't need to be there.

Will have to do some testing.

My whole world has turned upside down.
Title: Re: How do I use OR and AND in a browse filter with 4 elements?
Post by: Bruce on November 22, 2013, 12:00:41 AM
Hi Stu,

>> (embed code, not using the template),

so let's be clear.
If you are using a field in the prop:filter of the view - in other words using either the template setting, or hand-coding a prop:filter, then the field does not need to be in the VIEW.

If you are adding code inside the "Validate Record" embed, and doing "client-side" filtering to discard records you don't want, then you absolutely _DO_ need any references here to be in the VIEW.

Of course, adding to the prop:filter is better where possible because it is then filtered by the (database) server, before it is set to the web exe.

Cheers
Bruce
Title: Re: How do I use OR and AND in a browse filter with 4 elements?
Post by: Stu on November 22, 2013, 02:30:52 PM
Grandma. Eggs.

Thanks Bruce .. I'm not talking about ValidateRecord no. Talking about using loc:FilterWas in the Set Filter embed for the browse, and assigning to the prop:filter.

I guess I was confused though. About needing them in View Fields. Perhaps I was thinking of setting custom field values or something.