Odd list advanced filter issue

12 years 4 months ago #188149 by raniko
Odd list advanced filter issue was created by raniko
Hi. I am writing an advanced filter for a list that I am creating. The first part of the filter is:

(ue.`cb_providerneeds` REGEXP REPLACE('[cb_providertype]', '|*|', '|' ))AND ((ue.`cb_entcountry` REGEXP REPLACE( '[cb_countriesserviced]', '|*|', '|' ))OR (`cb_countriesserviced` LIKE '%All%'))AND (ue.`cb_invlocstate` REGEXP REPLACE( '[cb_regionserved]', '|*|', '|' ))

This works absolutely fine and returns the results that I would expect... However, when I add the following OR statement

OR (`cb_regionserved` LIKE '%All%'))

To make the entire filter:

(ue.`cb_providerneeds` REGEXP REPLACE('[cb_providertype]', '|*|', '|' ))AND ((ue.`cb_entcountry` REGEXP REPLACE( '[cb_countriesserviced]', '|*|', '|' ))OR (`cb_countriesserviced` LIKE '%All%'))AND ((ue.`cb_invlocstate` REGEXP REPLACE( '[cb_regionserved]', '|*|', '|' ))OR (`cb_regionserved` LIKE '%All%'))

...it breaks. The only part of the filter that still functions correctly is the very first condition:
(ue.`cb_providerneeds` REGEXP REPLACE('[cb_providertype]', '|*|', '|' ))

The rest of the filter breaks and all values are returned as if there is no code after that first condition. I find it odd that 1) the code does not work correctly and 2)that the addition of the OR statement breaks the filters behind it - It looks exactly the same as the OR statement before it that worked.... I'm not getting an error message and it seems like all of the code is accurate (to me anyway).

The fields cb_providerneeds, cb_entcountry and invlocstate are tied to the groups in the filter.

The fields cb_countriesserviced, cb_providertype and cb_regionserved are fields tied to the user running the query.

I'm using Joomla 1.7, and cb 1.7

If you have any suggestions, please let me know.

Many thanks.
Sorry for the long winded explanation :).

Please Log in to join the conversation.

12 years 4 months ago #188244 by krileon
Replied by krileon on topic Re: Odd list advanced filter issue
You're missing ue. on your ORs when selecting the table column. It also appears that the first AND is supposed to encompass country or region and have added brackets to surround the 2 OR situations. Other then that I don't really see any issue. Don't understand the purpose of the regex replace however, are you trying to check that they've selected multiple values?
( ue.`cb_providerneeds` REGEXP REPLACE( '[cb_providertype]', '|*|', '|' ) ) AND ( ( ( ue.`cb_entcountry` REGEXP REPLACE( '[cb_countriesserviced]', '|*|', '|' ) ) OR ( ue.`cb_countriesserviced` LIKE '%All%' ) ) AND ( ( ue.`cb_invlocstate` REGEXP REPLACE( '[cb_regionserved]', '|*|', '|' ) ) OR ( ue.`cb_regionserved` LIKE '%All%' ) ) )


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.

Please Log in to join the conversation.

12 years 3 months ago #188361 by raniko
Replied by raniko on topic Re: Odd list advanced filter issue
I made the suggested changes but it still breaks. Everything still works fine if I leave that last OR out... OR (ue.`cb_regionserved` LIKE '%All%')). I'm out of ideas on this one. If you can think of any other reason why this would break, please let me know.

The REGEXP REPLACE is there because I am looking to return any match from multi select fields. So, if cb_providerneeds has 1 selected value that matches cb_providertype that user would get returned.

Please Log in to join the conversation.

12 years 3 months ago #188372 by krileon
Replied by krileon on topic Re: Odd list advanced filter issue
Have you tried taking the query I've provided above and directly copying and pasting to the advanced filter? Not much more I can advise really, it looks fine. What results it returns can be subjective to whatever you expect it to return. Advanced filters are purely just adding to the userlists database query. With Joomla debug mode on you can scroll to the bottom of the page and see the exact query performed on SQL.


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.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.207 seconds

Facebook Twitter LinkedIn