Filter on empty field
AnsweredI would like to filter items with an empty value on a specific field, but I receive an error. How do I filter these items?
I tried:
$app = PodioItem::filter($app_id, array('filters' => array($FieldThatMustBeEmpty => '')));
Array400/item/app/2779441/filter/Invalid value u'' (string): Must not be empty
$app = PodioItem::filter($app_id, array('filters' => array($FieldThatMustBeEmpty => NULL)));
Array400/item/app/2779441/filter/Invalid value None (null): must be non empty string
-
Hi Stephan,
What is the field type you are filtering on? Not all field types accept null. As you can read on https://developers.podio.com/doc/filters only category, app, contact and question fields will filter on null.
All the best,
Andreas -
You cannot filter on text fields. You can see the list of fields you can use for filtering on the link in my previous comment. You can use the search interface for text fields, but it will also not allow you to search for the null value. If the app does not contain an excessive amount of items you can simply pull all the items in the app and do the filtering yourself.
All the best,
Andreas -
Filtering on text fields is not possible for performance reasons. As I mentioned above you can use the search interface to search a specific app. This will among other things search text fields. Read more about it here https://developers.podio.com/doc/search -- it's a pretty powerful tool.
/Andreas
-
Old thread I see, but I recently was looking to do this and found a solution that worked for myself.
I needed to filter based on empty an Number Field. One which recorded the estimate # and invoice # in QuickBooks. So I created a Calculation Field, which just checks for null through a series of if statements.
- 0 - Both fields are empty
- 1 - Estimate is filled, Invoice is empty
- 2 - Estimate is filled, Invoice is filled
There's probably a dozen ways to write this and I'm not the best at these logical calculations, but this is how I did it and was able to accomplish what I wanted.
Then to create the views I wanted in my Projects App, I filtered by this new field, based on number ranges. The following is for items that do not have an estimate entered (if they are in the estimating category):
And the following is for items that do not have an invoice entered (if they are in the invoicing category):
Hope this helps all future searchers looking to accomplish something like this.
Please sign in to leave a comment.
Comments
9 comments