Title: Problem with filter &#8211; empty fields
Last modified: August 22, 2016

---

# Problem with filter – empty fields

 *  Resolved [Lizuca](https://wordpress.org/support/users/lizuca/)
 * (@lizuca)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/)
 * Hello, first of all thank you for the amazing plugin – very useful and easy to
   use!
    And now the problem :). I have a field (accepted) with the following values:
   Yes, No, Unprocessed, the Default value being Unprocessed. This field is not 
   visible in the Signup form, so I noticed that even if the default value Unprocessed
   is displayed in the Admin part, in List Participants, when going to Edit the 
   record the field is actually empty. I don’t necessarily have an issue with this,
   since anyway I want the admins to manually change the value of this field, but..
   I have issues showing these records using pdb_list. The filter will not take 
   these records at all in consideration. I have a simple list: [pdb_list display_count
   = “true”], and it will show all the records, but when I will add a filter, like[
   pdb_list filter =”accepted=Unprocessed” display_count = “true”] it will not show
   anything – it doesn’t take into consideration at all the default value.. If I
   then go and edit the record by choosing the Unprocessed value from the Radio 
   Buttons list, then it’s ok..
 * Please help me with this, because I don’t find any other way of showing the Unprocessed
   records to the admin, in order for them to start editing..
 * Thanks a lot!
 * [https://wordpress.org/plugins/participants-database/](https://wordpress.org/plugins/participants-database/)

Viewing 15 replies - 1 through 15 (of 15 total)

 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514646)
 * OK, well the problem is, the plugin doesn’t save values to fields that are not
   in the form…it does not fill in the record with default values. (Perhaps it should,
   I’ll think about that) Anyway this means that when using the list filter in the
   backend…or in the shortcode…you need to filter for records that do not contain
   a value:
 * `[pdb_list filter="accepted!yes|accepted!no" display_count = "true"]`
 *  Thread Starter [Lizuca](https://wordpress.org/support/users/lizuca/)
 * (@lizuca)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514649)
 * Thank you for your quick reply, XNAU!!
    However.. this won’t work.. the filter
   just ignores the records with the empty accepted field. If I have a simple pdb_list,
   they will be visible, the issue is when I’m adding a filter..
 * I think the correct way of filtering would be [pdb_list filter=”accepted!yes&
   accepted!no” display_count = “true”], meaning “&” instead of “|” (if I want to
   make sure I exclude all the records, the Yes and the No ones), but as mentioned..
   it’s not working.(I tried both ways – the one suggested by you, and the one with&
   instead of |).
    Somehow filter statement ignores the record if nothing is found
   in that field. Any idea where i could see the code for this, to try to fix it?
 * Thanks a lot!
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514762)
 * OK, the “&” would work, sure. But what do you mean by “ignored”? Which records
   are showing in the list?
 * You could also try:
 * `[pdb_list filter="accepted=" display_count = "true"]`
 * Which will give you all the records with a blank “accepted” value.
 *  Thread Starter [Lizuca](https://wordpress.org/support/users/lizuca/)
 * (@lizuca)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514763)
 * The [pdb_list filter=”accepted=” display_count = “true”] doesn’t show anything…
 * What I meant by ignoring:
    – if i put only [pdb_list], the result will show me
   19 records (5 having accepted as Yes, 1 No, 1 Waiting List, 12 Unprocessed – 
   if I start adding filters (having ! as an operator) I’m “loosing” 7 records (
   out of the 12 records that have Unprocessed as a value, 5 of those I have updated
   in the Admin page, therefore the value is in the DB, the other 7 only show Unprocessed
   because is the Default value, but the field is probably empty in the DB). For
   example add [pdb_list filter=”accepted!Yes”], the result is only giving me 7 
   records (5 Unprocessed, 1 No, 1 Waiting List). The other 7 records having blank
   in accepted are not at all taken into consideration… I think there is a bug in
   the way the select is done, but not sure where to check. I hope it’s more clear
   now?
 * Thanks!!
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514776)
 * Your example (“accepted!Yes”) is giving the correct result, so I don’t see that
   there is a problem. (it’s showing all the records that do not have a value of“
   yes”) The filter I gave you for showing records with an empty field value does
   work, so there may be something stored in the fields you presume are blank.
 * It’s a good idea when solving this kind of problem to look at the database directly
   so you know exactly what is in there.
 * Which records do you want to see in your list?
 *  Thread Starter [Lizuca](https://wordpress.org/support/users/lizuca/)
 * (@lizuca)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514778)
 * Thank you again for your reply.
    However I have to disagree – the query “accepted!
   Yes” is not showing the correct results – because it doesn’t show as well the
   records having no value in the field (which respect the condition – do not have
   a value of “yes”). And yes – I have checked now the values in the database – 
   no value at all stored in those fields. I have also removed the Default value.
 * The pdb_list works fine, it shows all records – the issue comes when adding filter…
   What I’m thinking now – is there any DISTINCT in the SELECT done for the filter
   that would thus ignore the empty fields?
 * Thanks!!
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514802)
 * No there is no DISTINCT. I’m not sure what we’re seeing here because I have tested
   this and it works as expected. I didn’t understand that you weren’t seeing record
   with blank entries…those should be included.
 * I would like to know what result you are looking for in your list, so we can 
   focus on that.
 *  Thread Starter [Lizuca](https://wordpress.org/support/users/lizuca/)
 * (@lizuca)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514810)
 *  Thread Starter [Lizuca](https://wordpress.org/support/users/lizuca/)
 * (@lizuca)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514821)
 * Hello, I’m still facing the same issue, trying to figure out what’s wrong.
    I
   deleted all the records in the database, plus the accepted field and created 
   a new one. What I noticed: the filter “=” ([pdb_list filter=”phone=’]) works 
   find for the text fields, not having any value, but it doesn’t show any result
   for the fields defined as radio-buttons, having values defined (Yes, No, Unprocessed),
   even if there are 3 records that don’t have anything in that field… I tried with
   filtering with fields shown and not shown in he Signup form, and the same conclusion
   apply – doesn’t work for Radio-Button fields. Being part or not of the Signup
   page doesn’t influence anything.
 * Don’t know what to do know.. tempted to create a custom SQL and table to display
   the records, and drop the list shortcode..
 * What do you think?
 * Thanks!
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514822)
 * I see, you’re right, this doesn’t work as it should. This is because the column
   is filled with “null” values, which aren’t the same as an empty value. This is
   something I need to fix in the next release.
 * But for now, I offer this fix. You’ll need to run this query on your database
   to convert all the nulls to blanks. Then your filter will work. You may need 
   to change this if the prefix of your table is different or if you want to run
   it on another column.
 * `UPDATE wp_participants_database p SET p.approved = '' WHERE p.approved IS NULL`
 * Before doing this, backup your database (just in case!) then run the query using
   PHPMyAdmin or another database editing tool.
 *  Thread Starter [Lizuca](https://wordpress.org/support/users/lizuca/)
 * (@lizuca)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514823)
 * Thanks for the answer and the temporary fix.
    However :), this will fix my issue
   for the existing records.. I would need to come up with something for the new
   records being created as well (probably an update on the DB after record is inserted).
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514825)
 * Ah, yes…well, what you can do is alter the “approved” column so it doesn’t store
   a NULL in undefined fields. in PHPMyAdmin, where the column properties are defined,
   make sure default is set to “none” or blank and “Null” is set to “no”
 * Now, when a new record is created the ‘approved’ column will be blank, not NULL.
 *  Thread Starter [Lizuca](https://wordpress.org/support/users/lizuca/)
 * (@lizuca)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514827)
 * Thank you very much!! It did worked like this.
    My list shows the correct results
   now. Thanks for your help.
 *  [Andy60103](https://wordpress.org/support/users/andy60103/)
 * (@andy60103)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514907)
 * Hi, Am having exactly the same issue but with a dropdown list. First value in
   the list is ‘New’ as in ‘new member’ and the default value is ‘New’ but the pdb_list
   will not select them. I definitely vote for storing default values to the record!
   You cant use them if they are not saved so not sure what purpose they could have.
   You cant even select them in the admin nor select empty/null.Thanks
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514908)
 * yes, you’re right, and you can do both of those things in the new release.
 * did you attempt the fix I recommended above? It would work in your case too.

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘Problem with filter – empty fields’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

## Tags

 * [Empty Fields](https://wordpress.org/support/topic-tag/empty-fields/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [PDB_list](https://wordpress.org/support/topic-tag/pdb_list/)

 * 15 replies
 * 3 participants
 * Last reply from: [Roland Barker](https://wordpress.org/support/users/xnau/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/problem-with-filter-empty-fields/#post-5514908)
 * Status: resolved