Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

[SOLVED] Filtering Checkbox Multiple Field - Create a CB List

6 years 4 months ago - 6 years 4 months ago #306567 by haraldundandrea
Hello,

I try to filter a CB List using a multiple checkbox and I want to test if one of two possible values are found combined with OR (not with and).

If I create two lines, each with one condition, the list has 0 users, even if there are user which fullfill one of the conditions.

I have not found a possibility to combine the two values connected with OR.

I hope it is understandable what the problem is.
Last edit: 6 years 4 months ago by krileon. Reason: Added [SOLVED] tag to subject

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
6 years 4 months ago #306601 by krileon
Userlist filters are always AND. To filter against a multicheckbox or muliselect field having at least 1 of the supplied values you have to use REGEXP. Example as follows.

FIELD_NAME Is REGEXP /value_1|value_2/

Separate multiple values with |. If you need to filter by 1 field OR by another field you'll need to use Advanced mode and supply your own SQL that'll be added to the WHERE statement of the query.


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 or Create an account to join the conversation.

6 years 4 months ago - 6 years 4 months ago #306609 by haraldundandrea
Replied by haraldundandrea on topic Filtering Checkbox Multiple Field - Create a CB List
I do not know much about the syntax of SQL I suppose thats my problem here.

At last I tried this "('cb_suche' LIKE 'suche')" in the advanced mode as both values contains the string suche but that did not work.

I found some examples here in the forum but none of it worked for my purpose.

I also tried things like "(('cb_suche' = 'Bandsuche') OR ('cb_suche' = 'Musikersuche'))".

I think it is a problem with the syntax I used.

Should your suggested Expression FIELD_NAME Is REGEXP /value_1|value_2/ in my case be 'cb_suche' = /'Bandsuche'|'Musikersuche'/?
Last edit: 6 years 4 months ago by haraldundandrea.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
6 years 4 months ago #306624 by krileon

Should your suggested Expression FIELD_NAME Is REGEXP /value_1|value_2/ in my case be 'cb_suche' = /'Bandsuche'|'Musikersuche'/?

See my above example. If using a Basic filter to match 1 of 2 values in a multicheckbox you'd use the below usage.

FIELD_NAME Is REGEXP /value_1|value_2/

If your fields values are Bandsuche and Musikersuche then you'd use the below.

FIELD_NAME Is REGEXP /Bandsuche|Musikersuche/


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 or Create an account to join the conversation.

6 years 4 months ago #306630 by haraldundandrea
Replied by haraldundandrea on topic Filtering Checkbox Multiple Field - Create a CB List
I tried this

cb_suche Is REGEXP /Bandsuche|Musikersuche/

in advabced mode and became an error "Fehler: 1064"

What is wrong now?

P.S.: cb_suche is the name of the field with the multiple checkpox.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
6 years 4 months ago #306687 by krileon
The filter I've provided is for Basic mode. Advanced you need to supply completely valid SQL statements.


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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum