Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I create a view with two arguments: Taxonomy ID (tid) and Node NID (nid). I leave the default settings for tid and set a default argument for nid to a fixed value (let's say: 1). The tid argument is configured so that all values are shown in case it is not present. This should show all nodes except the one with NID 1.

BUT: This only works if the NID argument is the first argument. If it's the second argument, it is excluded from the query:

Query with nid as first argument:

SELECT node.nid AS nid
FROM node node
WHERE node.nid != 1  OR node.nid IS NULL

Query with nid as second argument:

SELECT node.nid AS nid
FROM node node

I'm wondering why that is? What I want to accomplish is actually to exclude the result of one view from another. To do that, I add nid as an argument, get the nids of a different view and tell views to exclude them. That works just fine, but only if nid is the first argument. But I need to have taxonomy as the first argument and I don't understand why that excludes my nid argument.

Although in a different context, I think I had the same problem here: http://stackoverflow.com/questions/20248929/filter-a-drupal-view-displayed-in-a-panel-by-taxonomy-term-depending-on-domainhttps://stackoverflow.com/questions/20248929/filter-a-drupal-view-displayed-in-a-panel-by-taxonomy-term-depending-on-domain

I create a view with two arguments: Taxonomy ID (tid) and Node NID (nid). I leave the default settings for tid and set a default argument for nid to a fixed value (let's say: 1). The tid argument is configured so that all values are shown in case it is not present. This should show all nodes except the one with NID 1.

BUT: This only works if the NID argument is the first argument. If it's the second argument, it is excluded from the query:

Query with nid as first argument:

SELECT node.nid AS nid
FROM node node
WHERE node.nid != 1  OR node.nid IS NULL

Query with nid as second argument:

SELECT node.nid AS nid
FROM node node

I'm wondering why that is? What I want to accomplish is actually to exclude the result of one view from another. To do that, I add nid as an argument, get the nids of a different view and tell views to exclude them. That works just fine, but only if nid is the first argument. But I need to have taxonomy as the first argument and I don't understand why that excludes my nid argument.

Although in a different context, I think I had the same problem here: http://stackoverflow.com/questions/20248929/filter-a-drupal-view-displayed-in-a-panel-by-taxonomy-term-depending-on-domain

I create a view with two arguments: Taxonomy ID (tid) and Node NID (nid). I leave the default settings for tid and set a default argument for nid to a fixed value (let's say: 1). The tid argument is configured so that all values are shown in case it is not present. This should show all nodes except the one with NID 1.

BUT: This only works if the NID argument is the first argument. If it's the second argument, it is excluded from the query:

Query with nid as first argument:

SELECT node.nid AS nid
FROM node node
WHERE node.nid != 1  OR node.nid IS NULL

Query with nid as second argument:

SELECT node.nid AS nid
FROM node node

I'm wondering why that is? What I want to accomplish is actually to exclude the result of one view from another. To do that, I add nid as an argument, get the nids of a different view and tell views to exclude them. That works just fine, but only if nid is the first argument. But I need to have taxonomy as the first argument and I don't understand why that excludes my nid argument.

Although in a different context, I think I had the same problem here: https://stackoverflow.com/questions/20248929/filter-a-drupal-view-displayed-in-a-panel-by-taxonomy-term-depending-on-domain

Source Link
yotka
  • 417
  • 4
  • 8

Why is Views ignoring nid as second argument?

I create a view with two arguments: Taxonomy ID (tid) and Node NID (nid). I leave the default settings for tid and set a default argument for nid to a fixed value (let's say: 1). The tid argument is configured so that all values are shown in case it is not present. This should show all nodes except the one with NID 1.

BUT: This only works if the NID argument is the first argument. If it's the second argument, it is excluded from the query:

Query with nid as first argument:

SELECT node.nid AS nid
FROM node node
WHERE node.nid != 1  OR node.nid IS NULL

Query with nid as second argument:

SELECT node.nid AS nid
FROM node node

I'm wondering why that is? What I want to accomplish is actually to exclude the result of one view from another. To do that, I add nid as an argument, get the nids of a different view and tell views to exclude them. That works just fine, but only if nid is the first argument. But I need to have taxonomy as the first argument and I don't understand why that excludes my nid argument.

Although in a different context, I think I had the same problem here: http://stackoverflow.com/questions/20248929/filter-a-drupal-view-displayed-in-a-panel-by-taxonomy-term-depending-on-domain