I'm trying to create a view that will display several different node types, but will only display the 'story' nodes when there are comments. I can filter the types and comment count easy enough, but how to filter the comment count only for the stories. Something like, if type == story && comment count != 0... but where to put it? as an argument?

Views is so awesome I'm sure this is possible, but just not sure how to implement it.

much thanks.

Comments

merlinofchaos’s picture

Interestingly enough, this actually isn't possible with Views, mostly because what you really want is an OR.

What you're really looking for looks like this:

WHERE (node_type IN ('foo', 'bar', 'types_that_are_not_story')) OR (node_type = 'story' AND comment_count > pi));

...and while I had intended for the Views 2 design to be able to do this, the feature got punted because I had to draw a line somewhere and actually get the software out.

That said, because I did design it that way, and because the underlying structure is there, you might check out the views_or module which attempts to take advantage of this structure and add filter groups which will allow you to do this. From my understanding it is not completely reliable but for something this simple, I think it should work.

merlinofchaos’s picture

Status: Active » Closed (won't fix)