filter a or b or c
-
I have a multi checkbox field. I want to filter on 3 of the possible options. So either value A or B or C
I added this to the shortcode -> filter=”status=Lid|status=Erelid|status=Lid van Verdienste”
But it does not include all items with value A, B or C
-
When you’re filtering on a multi-select type field, you need to use the “~” operator because the value in the record is usually going to be an array, and you need to look for your value within the array. If you take a look at the record values using a database tool like phpMyAdmin, you’ll see what I mean.
thanks, i changed the shortcode to filter=”status~Lid|status~Erelid|status~LidvanVerdienste”
however it does not show all records i would expect
I looked in the database with phpmyadmin and here are 2 records of the status field
a:1:{i:0;s:16:"LidvanVerdienste";}
a:1:{i:0;s:3:"Lid";}the records with “Lid” are included, but with status “LidvanVerdienste” and “Erelid” are not.
How can i get these records included in the filter?The go a bit deeper in this, you should turn plugin debugging on, clear the debugging log, then test the filter. The database query in the log will explain what’s going on.
I did the logging, but no clue where to look for in it:
PDb_List_Query::_restore_query_session getting session: list_query-1 got: Array
(
? [0] =>
? [where_clauses] => Array
?? (
????[status] => Array
????? (
?????? [0] => PDb_List_Query_Filter Object
????????(
????????? [fieldname:PDb_List_Query_Filter:private] => status
????????? [sql:PDb_List_Query_Filter:private] => p.status LIKE "%Erelid%"
????????? [or_statement:PDb_List_Query_Filter:private] => 1
????????? [term] => Erelid
????????? [index:PDb_List_Query_Filter:private] => 0
????????? [background:PDb_List_Query_Filter:private] => 1
????????? [like_term] =>
????????? [is_regex] =>
????????? [or_parenthesized:PDb_List_Query_Filter:private] => 1
????????)
?????? [1] => PDb_List_Query_Filter Object
????????(
????????? [fieldname:PDb_List_Query_Filter:private] => status
????????? [sql:PDb_List_Query_Filter:private] => p.status LIKE "%LidvanVerdienste%"
????????? [or_statement:PDb_List_Query_Filter:private] => 1
????????? [term] => LidvanVerdienste
????????? [index:PDb_List_Query_Filter:private] => 1
????????? [background:PDb_List_Query_Filter:private] => 1
????????? [like_term] =>
????????? [is_regex] =>
????????? [or_parenthesized:PDb_List_Query_Filter:private] => 1
????????)
?????? [2] => PDb_List_Query_Filter Object
????????(
????????? [fieldname:PDb_List_Query_Filter:private] => status
????????? [sql:PDb_List_Query_Filter:private] => p.status LIKE "%Lid%"
????????? [or_statement:PDb_List_Query_Filter:private] =>
????????? [term] => Lid
????????? [index:PDb_List_Query_Filter:private] => 2
????????? [background:PDb_List_Query_Filter:private] => 1
????????? [like_term] =>
????????? [is_regex] =>
????????? [or_parenthesized:PDb_List_Query_Filter:private] => 1
????????)
????? )
????[geb_datum] => Array
????? (
?????? [0] => PDb_List_Query_Filter Object
????????(
????????? [fieldname:PDb_List_Query_Filter:private] => geb_datum
????????? [sql:PDb_List_Query_Filter:private] => p.geb_datum LIKE "%jan%"
????????? [or_statement:PDb_List_Query_Filter:private] => 1
????????? [term] => jan
????????? [index:PDb_List_Query_Filter:private] => 3
????????? [background:PDb_List_Query_Filter:private] =>
????????? [like_term] =>
????????? [is_regex] =>
????????? [or_parenthesized:PDb_List_Query_Filter:private] => 1
????????)
????? )
?? )
? [sort] => Array
?? (
????[geb_datum] => Array
????? (
?????? [field] => geb_datum
?????? [ascdesc] => ASC
????? )
?? )
? [clause_count] => 4
? [is_search] => 1
)
[11/06/24 6:00pm UTC]PDb_List::_setup_iteration list query: SELECT p.id, p.first_name, p.last_name, p.geb_datum, p.address, p.zip, p.city FROM wp_participants_database p WHERE (p.status LIKE "%Erelid%" OR p.status LIKE "%LidvanVerdienste%" OR p.status LIKE "%Lid%") AND (p.geb_datum LIKE "%jan%") ORDER BY p.geb_datum ASC[11/06/24 6:00pm UTC]Cannot modify header information - headers already sentin /home/hhkhil8456/domains/hhkhillegom.nl/public_html/wp-content/plugins/litespeed-cache/src/optimize.cls.php on line 657[11/06/24 6:00pm UTC]PDb_List_Query::_restore_query_session getting session: list_query-1 got: Array
(
? [0] =>
? [where_clauses] => Array
?? (
????[status] => Array
????? (
?????? [0] => PDb_List_Query_Filter Object
????????(
????????? [fieldname:PDb_List_Query_Filter:private] => status
????????? [sql:PDb_List_Query_Filter:private] => p.status LIKE "%Erelid%"
????????? [or_statement:PDb_List_Query_Filter:private] => 1
????????? [term] => Erelid
????????? [index:PDb_List_Query_Filter:private] => 0
????????? [background:PDb_List_Query_Filter:private] => 1
????????? [like_term] =>
????????? [is_regex] =>
????????? [or_parenthesized:PDb_List_Query_Filter:private] => 1
????????)
?????? [1] => PDb_List_Query_Filter Object
????????(
????????? [fieldname:PDb_List_Query_Filter:private] => status
????????? [sql:PDb_List_Query_Filter:private] => p.status LIKE "%LidvanVerdienste%"
????????? [or_statement:PDb_List_Query_Filter:private] => 1
????????? [term] => LidvanVerdienste
????????? [index:PDb_List_Query_Filter:private] => 1
????????? [background:PDb_List_Query_Filter:private] => 1
????????? [like_term] =>
????????? [is_regex] =>
????????? [or_parenthesized:PDb_List_Query_Filter:private] => 1
????????)
?????? [2] => PDb_List_Query_Filter Object
????????(
????????? [fieldname:PDb_List_Query_Filter:private] => status
????????? [sql:PDb_List_Query_Filter:private] => p.status LIKE "%Lid%"
????????? [or_statement:PDb_List_Query_Filter:private] =>
????????? [term] => Lid
????????? [index:PDb_List_Query_Filter:private] => 2
????????? [background:PDb_List_Query_Filter:private] => 1
????????? [like_term] =>
????????? [is_regex] =>
????????? [or_parenthesized:PDb_List_Query_Filter:private] => 1
????????)
????? )
????[geb_datum] => Array
????? (
?????? [0] => PDb_List_Query_Filter Object
????????(
????????? [fieldname:PDb_List_Query_Filter:private] => geb_datum
????????? [sql:PDb_List_Query_Filter:private] => p.geb_datum LIKE "%krikke%"
????????? [or_statement:PDb_List_Query_Filter:private] => 1
????????? [term] => krikke
????????? [index:PDb_List_Query_Filter:private] => 3
????????? [background:PDb_List_Query_Filter:private] =>
????????? [like_term] =>
????????? [is_regex] =>
????????? [or_parenthesized:PDb_List_Query_Filter:private] => 1
????????)
????? )
?? )
? [sort] => Array
?? (
????[geb_datum] => Array
????? (
?????? [field] => geb_datum
?????? [ascdesc] => ASC
????? )
?? )
? [clause_count] => 4
? [is_search] => 1
)
[11/06/24 6:00pm UTC]PDb_List::_setup_iteration list query: SELECT p.id, p.first_name, p.last_name, p.geb_datum, p.address, p.zip, p.city FROM wp_participants_database p WHERE (p.status LIKE "%Erelid%" OR p.status LIKE "%LidvanVerdienste%" OR p.status LIKE "%Lid%") AND (p.geb_datum LIKE "%krikke%") ORDER BY p.geb_datum ASCin the above i searched in the filterd list for ‘jan’ , there are a few items presented but not the record which has ‘LidvanVerdienste” selected
then i searched for ‘krikke’ , no results but there should have been one because ‘krikke’ has “Erelid” selected
OK, the only thing you need to look at there is the line that begins with
PDb_List::_setup_iteration list query:
You’ll see there that there is an “AND” in the query, this is limiting the results.
How ddo I get rid of the AND?
The docs say to use pipe symbol for OR
That part of the query is not coming from the shortcode filter, looks like it’s a search term.
I understand now, search is only enabled for another field so it wont find it with the search i did
thanks for the support
- You must be logged in to reply to this topic.