1

I am trying to exclude entries that either have no value or a value of "0" in a field, but am running into problems with the 'search:' parameter.

search:product_inventory="not IS_EMPTY"

works and excludes all entries that have no value in that field.

As I also want to exclude fields with the value of zero, I changed it to:

search:product_inventory="not IS_EMPTY|0"

This threw this error:

Error Number: 1054

Unknown column 'wd.field_id_8NOT' in 'where clause'

SELECT DISTINCT(t.entry_id) FROM exp_channel_titles AS t LEFT JOIN exp_channels ON t.channel_id = exp_channels.channel_id LEFT JOIN exp_channel_data AS wd ON wd.entry_id = t.entry_id LEFT JOIN exp_members AS m ON m.member_id = t.author_id INNER JOIN exp_category_posts ON t.entry_id = exp_category_posts.entry_id INNER JOIN exp_categories ON exp_category_posts.cat_id = exp_categories.cat_id WHERE t.entry_id !='' AND t.site_id IN ('1') AND t.entry_date < 1358591770 AND (t.expiration_date = 0 OR t.expiration_date > 1358591770) AND t.channel_id = '2' AND exp_categories.cat_id = '68' AND t.status = 'open' AND ( (wd.site_id=1 AND wd.field_id_8!="") AND (wd.site_id=1 AND wd.field_id_8NOT LIKE "%0%") )

Filename: modules/channel/mod.channel.php

Line Number: 2660

Using:

search:product_inventory="not 0|IS_EMPTY"

throws the same error.

I then tried:

search:product_inventory="= not 0"

which successfully excluded the entries with a '0' in that field.

I changed this to:

search:product_inventory="= not 0|IS_EMPTY"

but this time the 'IS_EMPTY' is being completely ignored and all entries that have no value in that field are still returned.

How can I successfully exclude entries that have no value or a value of '0' in that field?

I am running EE v.2.5.3.

  • I've run some tests on a 2.5.5 installation and can't replicate your problem - this works ok for me: search:product_inventory="not IS_EMPTY|0" I couldn't find anything in the changelog that might indicate that it's a 2.5.3 bug, but may be worth upgrading all the same. – James Smith Jan 19 '13 at 12:50
  • Thanks for checking this - good to know this isn't an issue in later versions. – Katrin Jan 21 '13 at 10:39
3

This works:

search:product_inventory="=not 0|IS_EMPTY"

The key is the equals sign immediately preceding not, and IS_EMPTY at the end (the order seems important for some reason)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.