0

I want to create a view with a field which shows an indirect referenced contenttype (see Design) using Drupal 6.

I have 3 content types: Person, Organization and Workgroup.

Each person is related to only one organization by the node reference field: field_related_org_unit. Multiple persons can be linked to the same organization.

Each workgroup is related to only one organisation by the node reference field: field_supported_org. Multiple organizations can have the same workgroup.

Now I want a view which displays the information of a certain person (firstname, lastname) and in the same view I wan to show the workgroup which he is indirect related to (sharing the same organization).

So say, Person A is related to organization XYZ. Workgroup B is related to organization XYX. I want to show the title of Workgroup in the view.

I tried several relationships in the View, but couldn't get it working. see Setup View

Is it possible to realize this kind of setup? Could someone help me out?

2
  • What is the cardinality of these relationships: eg one workgroup -> many organizations? One Organization -> many workgroups? etc.
    – Triskelion
    Commented Feb 28, 2013 at 18:05
  • are you using Drupal 6 or 7
    – Aboodred1
    Commented Feb 28, 2013 at 18:07

1 Answer 1

0

The node reference fields in both the person and the workgroup both point to the same organization. Set up a relationship between person and workgroup on the organization field. That should make the workgroup name available to the view.

5
  • Triskelion, I tried it, but didn't work out because (I guess) the field is not the same in the Contenttype Person and Contenttype Workgroup. For Person I have the nodereference field: field_related_org_unit. For Workgroup I have the nodereference_field: field_supported_org. But maybe I am doing something wrong.
    – Paul
    Commented Feb 28, 2013 at 18:19
  • If both fields are for the same purpose, you can use the same field in multiple content types. eg Person->field_org and Workgroup->field_org. You can set one content type to accept multiple values. Conceptually, both fields are for the same purpose: to point to an organization.
    – Triskelion
    Commented Feb 28, 2013 at 18:22
  • Triskelion, due to permission settings it is not possible to use the same field (unfortunately).
    – Paul
    Commented Feb 28, 2013 at 18:23
  • Sorry to mislead you. I have been digging into this and the answer is 'You cant get there from here'. Relations in D6 create LEFT JOIN statements. This has been partly addressed in D7 with the Equi Join module, but I have not found any D6 solution. So simple in SQL. Have you considered creating your own code and bypassing views?
    – Triskelion
    Commented Feb 28, 2013 at 19:50
  • Thanks for your input! I think I will create another view which takes the organization as argument and returns the workgroup. I can call this view from the original view with views_get_view_result.
    – Paul
    Commented Feb 28, 2013 at 20:02

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.