Think of a filter like this:
-----
Filter criteria
- Content: Published (Yes) AND
- Content: Type (= Article)
OR
- Content: Published (Yes) AND
- Content: Type (= Basic page) AND
- Content: Show in newsfeed? (= 1)
-----
(Please excuse any translation problems. My Drupal is in German and I hope I used the correct English phrases.)
As far as I know, the given filter criteria should give you a list of all(!) articles, but only of those basic pages which have the (individually added) check box "Show in newsfeed" ticked.
Unfortunately, only the ticked basic pages but none of the articles are listed in this view. At the time you add the Show-in-newsfeed-criteria to the view, it blocks out every article, although it should not relate to articles at all.
I think, views like that worked fine a couple of weeks ago, but they do not now. So perhaps it is a problem that occurs only with the newer version(s) of the module.
Comment | File | Size | Author |
---|---|---|---|
#4 | viewsANDOR.png | 10.48 KB | holtzermann17 |
Comments
Comment #1
chaloum CreditAttribution: chaloum commentedI think you may need to do this
Content: Published (Yes) AND
Content: Type (= Basic page) AND
Content: Show in newsfeed? (= 1)
OR
Content: Published (Yes) AND
Content: Type (= Article)
or perhaps this
Content: Published (Yes) AND
Content: Type (= Basic page, Article) AND
Content: Show in newsfeed? (= 1)
Comment #2
quadratur CreditAttribution: quadratur commentedThanks for your suggestion.
I already tried to change the order but keep the logic of the rules, but that did not work. And because the articles do not have a field named "Show in newsfeed", the latter suggestion shows the same (wrong) result, which means it does not show any article at all.
In this construction:
Content: Published (Yes) AND
Content: Type (= Article)
OR
Content: Published (Yes) AND
Content: Type (= Basic page) AND
Content: Show in newsfeed? (= 1)
it seems that the views module uses the show-in-newsfeed-criteria for the article, although it should NOT do that, because it is a completely different branch of the filter criteria.
A possible workaround for me is to create the same field "Show in newsfeed" within the content type Article and set it to ticked. But this should not be the final solution, because in my opinion, the module mixes up the filter criteria in a completely wrong way.
I think, this is a serious bug.
Comment #3
quadratur CreditAttribution: quadratur commentedAnother far easier workaround:
No additional field within the content type Article, but the following filter criteria:
Content: Published (Yes) AND
Content: Type (= Article)
Content: Show in newsfeed? (empty)
OR
Content: Published (Yes) AND
Content: Type (= Basic page) AND
Content: Show in newsfeed? (= 1)
This keeps the "Show in newsfeed = 1" strictly away from the articles. (But again there is a problem here, because the order of the rules can lead to different results although the logic stays the same. This, too, makes me think, that there is a big problem within the filter handling.)
Still I think the module should work properly with the filter criteria given in my first comment. At least, similar mysql views (SELECT statements) in other databases work fine that way.
Comment #4
holtzermann17 CreditAttribution: holtzermann17 commentedI'm also having a very similar problem on Views 7.x-3.4.
The attached screenshot shows: I want items that are either Groups with a given property OR some other specific type. What I end up getting is (apparently) just groups.
I think this is potentially related to another issue I reported which has to do with the way Views generates SQL queries: https://drupal.org/node/1770742
Comment #5
areikiera CreditAttribution: areikiera commentedI have exactly the same problem.
Content: Published (Yes) AND
Content: Type (= Article)
OR
Content: Published (Yes) AND
Content: Type (= Basic page) AND
Content: Featured (= Yes)
That view only returns Articles (I have Basic pages marked as Featured; removing the Featured field does allow pages to appear in the view, but unfiltered as needed). Tried the workaround from comment #3, which did not work for me. Without that workaround, it's an even bigger problem. Any updates on this? And is anyone else still experiencing it?
Comment #6
dawehnerIt would be cool if you could enable to show the runned sql (it's under the views settings) and show it here.
This has the advantage that you can easy see, whether this is a problem of the generated sql, thanks.
Comment #7
areikiera CreditAttribution: areikiera commentedDefinitely! This is for a different example than the one mentioned in my previous comment. The Filter Criteria looks like this in my view:
The SQL query is below:
This only shows me data from the second filter group (I definitely have data for both). Thanks!
Comment #8
janvonmulert CreditAttribution: janvonmulert commented+1
Comment #9
Dean Clayton CreditAttribution: Dean Clayton commentedI came across the exact same problem.
Tested the workaround suggested in 3, and i did actually get it to work. As stated, I had to get the ordering of the individual filters correct.
for me it was done as follows:
Content: Published (Yes) AND
Content: Type (= Comic Issue) AND
Content: News type (empty)
OR
Content: Published (Yes) AND
Content: Type (= News) AND
Content: News type (= Latest Site Updates)
When the News type (empty) was before the content type OR in the 2nd group it didn't appear to work.
Doing some searches, this is related to this issue = Many-to-one filters, OR-groups and INNER JOIN, so related them together.
Comment #10
scott.browne CreditAttribution: scott.browne commentedI see this issue is still active even with the new version. I tried the work around but it only allows for one type to be viewed. The second still appears blank.
Comment #11
ikeigenwijs CreditAttribution: ikeigenwijs commentedstill alive
And
published
promoted to front
Is of Type A,B
And
or Term A of contenttype A
or Term B of contenttype B
Shows nothing (and should)
Comment #12
padinek CreditAttribution: padinek commentedAgreed... still alive, even in 7.x-3.14
It seems only evaluate the first part of the "where" condition.
Because if I inverse the both parts, I get another result... (and of course, I need both results :D )
Comment #13
padinek CreditAttribution: padinek commentedComment #14
padinek CreditAttribution: padinek commentedIn relation with my previous comment :
that line :
INNER JOIN {field_data_field_publish_in_news} field_data_field_publish_in_news ON node.nid = field_data_field_publish_in_news.entity_id AND field_data_field_publish_in_news.entity_type = 'node'
If I remove the concerned field filter, the both conditions are well evaluated.
The INNER JOIN was the problem, then ?
Comment #15
martinjmurph CreditAttribution: martinjmurph commentedStill seems an issue for me. However based on the comments in this thread, I seemed to get the results I was after with the following.
Content: Published (Yes) AND
Content: Type (= Report)
OR
Content: Published (Yes) AND
Content: Type (= Article) AND
Content: Publish as a report (not empty)
The inner join seemed to be the problem for me. However with the filters above this did a left join, and as I said is now bringing back the required results for me.
Comment #16
quintard CreditAttribution: quintard commentedViews 7.x-3.18
I have defined 2 new content types : 'News' and 'Report'
content type 'News'
(...)
field type = A,B,C,D,E
field date_news
content type 'Report'
(...)
field date_report
I want to list the News and the Reports of type D or E
in Views - filter criteria I have :
Content: Publish (Yes) AND
Content: Type (= News) AND
Content: Type (not A,not B, not C)
OR
Content: Publish (Yes) AND
Content: Type (= Report) AND
if I write the line as above :
Content: Type (not A, not B, not C) => working fine - the News and Reports are properly displayed.
but if instead I write :
Content: Type (or D, or E) => the news are properly displayed BUT no report displayed.
Comment #17
TomasComsolvia CreditAttribution: TomasComsolvia commentedI found this issue also. Adding Content: News type (empty) to the first group didn't work.
However, changing the weight of the rows made it work correctly. When I clicked "Show row weight" it was out of order. I rearranged to 1,2,3,4 and all is good! :)
Comment #18
samerjh CreditAttribution: samerjh commentedI found a solution in my case where a news-type (String List Field) was one of my conditions, Instead of add condition type is one of (and choose elements); I choose is none of (and choose the opposite). this solved the problem for me
Comment #19
joseph.olstadCorrect me if I am wrong but this appears to be a duplicate of:
#2908538: Thousands of results after update to 3.18 - Put extras in parentheses, otherwise OR conditions in extras not correctly enclosed
This is fixed in the dev branch and will be included in the 7.x-3.19 release.