Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
31 Jul 2008 at 16:38 UTC
Updated:
21 Jan 2009 at 20:40 UTC
Is it possible to do the Views query on a specific node reference field (i.e. the results will come from the referenced nodes) - Same as ReferencedByFilter for D5.
Comments
Comment #1
merlinofchaos commentedYes, add a relationship on that node reference; add all your fields for the referenced node and add your argument on the basic node.
Comment #2
ratnesh aarohi commentedI think my need is similar - i have one cck with book name, book author, Book number, book publisher, book references etc (some more fields);
Next i have another cck called bookreading_schedule with two fields - one date and another (a node reference) to the above book name.
Now I want a view (based on node: 'bookreading_schedule') with date, book name, book author and book number (only these four fields)
How do i do this
1. how do i set the relationship to the node reference
2. how do i get only the selected fields from the referred node to show up in views in tabular form
thanks
ratnesh
Comment #3
amitaibu@merlinofchaos,
Thanks for the quick reply - I've added documentation about it: http://drupal.org/node/289738
Comment #4
ff1 commentedComment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #6
tiago.gmarques commentedWhat if I want it the other way around?
With this I mean that I want to view the nodes that reference a certain node on that node display.
For example:
Node type - Artist;
Node type - Song (with a node reference field for the Artist);
View of Songs by a certain Artist on that Artist node.
Is this possible?
Comment #7
jeremy_a commentedslider:
Argument: node reference (Artist)
Fields: Node title, etc
Filter: node type: Song
Cheers
Comment #8
tiago.gmarques commentedReally? I had already tried it and wasn't able to do it.
I am displaying the view in a block and inserting it in a panel in the node.
In the arguments option, when I select the node reference if I choose 'Display empty text' in 'Action to take if the argument is not present', I get no views all the times. However if I choose 'Display all values' I get all the Song typed nodes. So it's as if the Argument is not working at all... What could I possibly have done wrong in here?
How should I configure the 'Validator options'?
Thanks for the help.
Comment #9
jeremy_a commentedHi slider,
It sounds you need a default argument in your block. If the nid (node number) you want is argument 1 in the url (eg node/123) choose "provide default argument" and "PHP Code" and enter this:
For the validator, you could choose "Validate by node type" then choose "artist" so that the block returns only artist results.
Comment #10
tiago.gmarques commentedExcellent! It works flawlessly. Thank you a lot!
Just one thing, when I choose 'Provide default argument', there is one option 'Node ID from URL' that works fine, so no need to use the PHP Code.
I am going to create an entry explaining this in the documentation.
Comment #11
tiago.gmarques commentedComment #12
merlinofchaos commentedThis is already explained in the documentation.
Comment #13
tiago.gmarques commentedI am not so sure...
What I found was the following tutorial (http://drupal.org/node/289738). This explains how to create a view of the nodes a certain node reference.
What I am talking about is the opposite, which I think is more useful, that is to create a view in a certain node, of the nodes that refer to that node. This I couldn't find it anywhere.