Hi,

* I have 2 content types: "book" & "author"
* In both content types, we have a dropdown called "category".
* e.g.
- A book has a category called "science".
- An author has a category called "science" as well.
- My query 1: I have an actual book (under "science") and I want to pull all authors (under "science").
- My query 2: Similarly, I have an author (under "science") and I want to pull all books (under "science").
- How do I do that?

Comments

nevets’s picture

You can use views, in this case you will want two views, one listing books, the other authors.

In both cases you will want

  • A contextual filter on "Content: Nid", with "Provide default value" selected and type of "Content ID from URL"
  • A relationship on "Content: Taxonomy terms on node", with "Require this relationship" checked

You can either use block displays, or use eva and attached fields to the content types.

kenpeter’s picture

* I have a view "authors_under_book" (this lists all authors, if I type book node id in the url)
* I have "node id" set up in the view only, so I can see what are going to displayed.
* Filter criteria: I make it as "author" content type, because that is the only thing I want to see now.

* Context filter: I did what you said, which is the node id form url.
* Content: Taxonomy terms on node, I did that as well. I have my "category" entered.

* It is not working.
* When I enter book node id, it shows nothing.
* When I enter author node id, it just shows the author node id.

nevets’s picture

Are you showing nodes or fields? Is the relationship being used to display information?

kenpeter’s picture

Hi,

* I am going to show the fields of author.
* Currently, I set it to node id of author, so I can see whether it is working correctly or not.
* I am a bit confused with the relationship.

* In sql,
- book id --> category id --> author ids (book and author share the same category)
- How do I do it in view, what I did to the relationship is to select "category" taxonomy. Is it enough?

nevets’s picture

For each field you display there is a setting for the relationship to use, you want the fields to use the relationship you added.

kenpeter’s picture

Hi,

* I am sorry. I don't understand it. (I guess I need specific steps)
* That is my current set up --> http://i.troll.ws/e42708c7.png
* Slightly different, but it is to list profiles under one program.
* I also came across this article --> http://scito.ch/content/show-related-nodes-block-based-taxonomy-terms-vi...

nevets’s picture

Under fields you are not using the relationship.

Configure each field, toward the top of the form will be a drop down that allows you to specify the relationship to use.

kenpeter’s picture

* I am sorry, I don't think I see the relationship any way.
* Is it under "sturcture" of the admin menu?
* Do you may to post a screenshot?

kenpeter’s picture

Hi,

* http://drewish.com/node/127
* I just watch this video, it seems there is a relationship drop down in each field. This is view 2.
* I am using view 3 and I didn't see this. (I may miss some here)

nevets’s picture

Ok, I have sent you down a bad path, I can not recreate what I had done earlier so it means I left out a step (which I can not recall off the top of my head). But I did find this comparison of modules that might help: http://drupal.org/node/323329. Similar Terms looks like a possibility and has views support.