Need some help getting a view setup just right.

I have a content type called 'Reviews' which includes an image field called 'teaser_image.' I then have a view which displays a list of all the posts of the Review type that also include a teaser_image. I achieved this by setting a filter to content: teaser_image True. So far so good. What I now want to do is create a view that lists all the Reviews which have no teaser_image.

Unfortunately, no matter what I try the view returns nothing. You would think this would be as easy as simply setting the filter to content: teaser_image False, but this returns nothing at all. I've tried to create an argument that does this, but I can't seem to figure it out.

Any help would be appreciated.

Comments

will_kelly’s picture

Got Drupal has a great tutorial http://gotdrupal.com/videos/drupal-views-relationships on relationships and http://gotdrupal.com/videos/drupal-views-arguments on arguments.

You said that your teaser image is set to False? You should have an option to choose "is empty (NULL)".

Arguments and relationships will be a better method because you can create a single view and override the settings for display in each page or block.

Dmaddox’s picture

Thanks for the links. I already watched both of those and, while informative, they didn't help me in this particular case.

The filter I have set on the teaser image is 'Content: Teaser Image (field_teaser_image) - list' and the only options I get with that are True and False. If I set it to True, it works exactly as you would expect, displaying all the reviews that also have a teaser image. This is the opposite of what I want. If I set it to False, it returns nothing.

This is what the querry looks like when set to True:

WHERE (node.status <> 0) AND (node_data_field_teaser_image.field_teaser_image_list <> 0)

This is what the querry looks like when set to False:

WHERE (node.status <> 0) AND (node_data_field_teaser_image.field_teaser_image_list = 0)

With field types other than image, I get the options such as 'Is one of,' 'Is none of,' 'Is empty (NULL),' etc. But I don't get those options when the field is an image type.

There ought to be a simple way to do this using an argument, but I need some more specific guidance on how to do it.

Dmaddox’s picture

Any thoughts on this?

What I'm trying to do is simple. I just want to create a view that filters out all the posts that already have a teaser_image. I don't understand why I can easily filter all the posts that do have a teaser_image, but it won't let me filter those that don't.

Dmaddox’s picture

I believe what I need to do is change the querry from:

WHERE (node.status <> 0) AND (node_data_field_teaser_image.field_teaser_image_list = 0)

To:

WHERE (node.status <> 0) AND (node_data_field_teaser_image.field_teaser_image_list IS NULL )

Is there any way to create an argument like this?