NetTalk Central

Author Topic: How do I use OR and AND in a browse filter with 4 elements?  (Read 4320 times)

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
How do I use OR and AND in a browse filter with 4 elements?
« 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.
Mike Grigsby
Credify Systems
Central Oregon, USA

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: How do I use OR and AND in a browse filter with 4 elements?
« Reply #1 on: November 19, 2013, 04:28:33 PM »
try

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

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: How do I use OR and AND in a browse filter with 4 elements?
« Reply #2 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.
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How do I use OR and AND in a browse filter with 4 elements?
« Reply #3 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

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: How do I use OR and AND in a browse filter with 4 elements?
« Reply #4 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.
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How do I use OR and AND in a browse filter with 4 elements?
« Reply #5 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

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: How do I use OR and AND in a browse filter with 4 elements?
« Reply #6 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.
Cheers,

Stu Andrews