I have 2 content types: Requests and Implementations. I have a CCK node reference field in Implementations that references Requests. I would like to be able to do some things with Views that I could use some help with:
1. Create a tabular view of Requests that includes a link to the related Implementation (I have created a tabular view of Implementations with a link to the related Request, but I can't seem to go the other way)
2. Create a view of Implementations which is filtered by a user reference field in the related Request (I can add the filter, but it doesn't seem to work--I get 0 results when I know there should be some)
Maybe Views isn't the way to go here? Or maybe there is an alternative to the CCK node reference field which would support my needs? Any thoughts and suggestions are much appreciated!
Comments
the compliment of the
the compliment of the nodereference field is the nodereferrer field. It's a dev, but it seems to work pretty well so far.
For question 1, you should have a "Node reference:" field available in the views field list. That will provide the link you are looking for.
===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime." -- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz
Thanks,
Thanks, WorldFallz.
Regarding question #1: I only see "Node reference: Related Request" in the list of fields to include in my tabular view. What I want is "Node reference: Related Implementation". It seems like the relationship created by the CCK node reference field is only 1 way which really doesn't make sense to me.
Regarding question #2: From what I can see, Nodereferrer allows you to include additional fields from the referenced node (in my case the Request) in the pull-down menu for selecting the referenced node (which is part of the Implementations form). I can see how that could be useful to someone, but for me just having the node name was good enough for making the selection.
What I was trying to do was to create a tabular view of Implementations and then filter against a field in the referenced Request. So, for example, you could see a list of all Implementations for which you are the "lead" in the referenced Request (where lead is a user reference field).
nodereference is only 1 way,
nodereference is only 1 way, to get the full 2 way relationship you need nodereferrer which is the other 1/2 of the relationship. The nodereference field goes on one content type and nodereferrer goes on the other.
nodereferrer gives you 2 things: 1, a readonly cck field that is a list of all the nodes that reference the one your looking at and 2) a filter for views so you can create a view of those back references (you can then use insert_view to place that list any where in a node you want).
===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime." -- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz
Oh, really? I guess I am
Oh, really? I guess I am not understanding how to use nodereferrer. I'll take a look at it again. If you know of any good documentation etc., please let me know.
Thanks again!
Other alternatives that might be simpler?
Using modules such as http://drupal.org/project/relativity or http://drupal.org/project/nodehierarchy might more easily accomplish your goal.
The cool thing about relativity is that you access the parents or children of a node in views just like you are trying to accomplish. Also there is more flexibility because 1 node can link to many nodes instead of just another node.
Play around with relativity and see if it accomplishes your objectives.
As long as we're reviewing
As long as we're reviewing node relationship modules... there's also http://drupal.org/project/node2node and http://drupal.org/project/nodefamily. There's also a pretty good comparison of relationship modules on the node2node project page.
I've tried them all and they all had some quirks that interfered with what I was trying to do. With nodereference/nodereferrer you gain more control over the details of the relationship, but it's definitely more work.
Also note, it is NOT not limited to one nodereference-- nodereference fields can be multivalue.
===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime." -- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz
Thanks for all the leads. I
Thanks for all the leads. I have tried almost all of them and this is what I have found so far:
RELATIVITY AND NODE HIERARCHY: These seem the most promising. I don't think I will be able to create a view of Implementations which is filtered by a Request field, however, since with these modules, you can easily access the Implementation from a link in the Request, I will just use a view of Requests for navigation. I have gotten pretty far implementing relativity but have hit a wall (http://drupal.org/node/309417). I think I will see if I have better luck with Node Hierarchy now. I'll post my results later. BTW, the one big downside for me of these two modules is that relationships are not established with the cck nodereference field so I can no longer use Automatic Nodetitle :(
NODEREFERRER: I couldn’t get nodereferrer to do what I want. I think I have it setup correctly. I put a nodereferrer field on my Request form and it is nice in that it displays a link to the related Implementation. However, it still doesn’t allow me to add that link into a tabular view of requests (there is nothing in the Fields menu on the view config page for this field). And there is still no way to filter Implementations by a Request field. I see that you can now filter Requests by whether they are IN or NOT IN the node reference field on Implementations, but I don’t know what that means or how that would help me. Additionally, when I try to use that filter, I get some SQL errors.
NODE FAMILY/VIEWS FUSION: The Node Family/Views Fusion route seems promising, but I can’t make sense of how to use Node Family. If there is no UI, how do you indicate which specific Requests are parents of a certain Implementation? I found an old post (http://drupal.org/node/76116) on this where fago says “this could be achieved easily with e.g. the cck node reference field type” but how? I have the cck node reference field in there and that doesn’t seem to be read by Node Family. I was able to get a fused view with information from both Requests and Implementations but (1) they don’t map up right and (2) the Implementation information only displays intermittently (the implementation-related columns just disappear if you click “next” or navigate away from the page and come back).
NODE2NODE: Node2Node isn’t going to work because it is only recommended for D6 and I am still on D5.
Update on NODE HIERARCHY.
Update on NODE HIERARCHY. It doesn't allow you to specify the cardinality of the parent child relationship, so there is no way for me to say that there should only be one Implementation per Request. Additionally, there is less control over how the related links are displayed than the Relativity module. With Node Hierarchy, the children are accessible only from a table labeled "Children" which isn't going to be intuitive to my users. Overall, I think Relativity seems like the way I want to go, i just need to get past this issue: http://drupal.org/node/309417.
Your node relativity error
May be a duplicate of:
http://drupal.org/node/76828
Yes, it was a duplicate and
Yes, it was a duplicate and I was able to fix it by modifying the 'name' column of the 'variable' table to 256 characters. Thanks so much for all your help. Relativity is awesome.