[SOLVED] list filter

12 years 3 months ago - 12 years 3 months ago #188432 by AlanJones
[SOLVED] list filter was created by AlanJones
I have searched through all the SQL tutorials for how to do this but can't seem to find it. But it must be possible.

I'd like a list which shows users who have an option of a couple of words from a category field that could have a lot of words. So for example
field cb_area has the following for a user 1: Accommodations Hotels Motels Bed and Breakfast.
For user 2: Accommodations Bed and Breakfast
For user 3: Bed and Breakfast
I'd like a list which lists only users with Accommodations and/or Motels in this field. So both users 1 and 2 should be in the list but user 3 should not.
I have tried all kinds of advanced filters. The one that should work is:
`cb_area` IN('Hotels','Accommodations','Motels')
It's probably really simple, could you help?

Own Your Own Community!

Please Log in to join the conversation.

12 years 3 months ago #188439 by krileon
Replied by krileon on topic Re: list filter
IN is for a list of values and it's an exact match. What you're looking for is LIKE with wildcards, but as you want to match multiple values I suggest using REGEX. Example as follows (Advanced filter).
( ue.`cb_area` REGEXP 'Hotels|Accommodations|Motels' )

The | in the above basically means "or" so you can add more, less, or make the current more specific as you please.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: AlanJones

Please Log in to join the conversation.

12 years 3 months ago #188441 by AlanJones
Replied by AlanJones on topic Re: list filter
Thanks that works perfectly!

Alan

Own Your Own Community!

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.177 seconds