10

I got a view, which lists nodes of same type, a "Other activities" view, i use this view on a activity node view. However i don't want the node i am currently viewing, to show in the list as well.

So what i did, was to make a contextual filter for nid, and provide a default value of "Content ID of URL", of course now my list only provides me with the currently viewing node.

Isn't there anyway to negate this? So it shows all other nodes, that don't have the nid, og the current?

2 Answers 2

16

There is an option on contextual filters to exclude the resulting value, rather than limiting the search to that value. Turn on this checkbox, and you should have the results you are seeking.

enter image description here

2
  • 1
    This was a big help. Commented Jan 28, 2014 at 13:50
  • 1
    Note: This option does not appear in all contexts; for example, when using Comment count or the Global Null item
    – dreftymac
    Commented Mar 6, 2017 at 22:28
1

https://www.drupal.org/project/views_negate

Synopsis

The Views Negate module provides a "Not Equal" to condition for textfield and list field in contextual filter. It works same as exclude option of numeric type field.

A checkbox with "Negate" label is added under "MORE" fieldset. By selecing the Negate option, it applies the "not equal" condition or "not in" if selected "Allow multiple values" option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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