6

I have a site that has an Organization content type. Each organization has an associated Profile2 profile that contains a reference to a Taxonomy vocabulary depicting the hierarchy of the organization. When users register, they are presented with the given Profile2 profile associated with the organization they belong to.

I am creating a report in Views that needs to display the following:

  • Organization
    • Hierarchy
      • User

I can establish a relationship between the organization and the Profile2 profile, and the profile and the taxonomy. However, I cannot find a way to establish a relationship between a given Profile2 profile and the users who are associated with that profile. Does anyone know if I should be able to establish this relationship, or is it going to require some custom Views code?

Or, if anyone has a better suggestion on how to create this hierarchy, I'm open to suggestions.

Thanks!

  • Oh - just reread the question carefully and spotted that you asked it in September 2012 not September 2014 - I guess things have moved on a long way by now. – digitalsean Dec 22 '14 at 16:36
1

As I understand it, several 'profile types' with different fields and questions relevant to various 'organizations' in your company.

Here's a suggestion to create a view which shows a list of the details in all profiles grouped by 'organization field' and sorted by the various 'hierarchy fields'.

The key to making this work is that the different profile types have a couple of fields in common eg. organization, first name, surname etc. Assuming each profile type uses the same 'field_organization', 'field_first_name', 'field_surname' we can use table view and grouping. If we need to display profiles with different fields, then add the fields and select another view type such as list view instead.

You may be able to do this even if only field_organization is in common in all the profiles (with list format instead of table format. Even if the profiles have other fields which don't match, they can be combined into the same report using 'list view' instead of table view.

  • Create a new view.

  • Either: Show 'Profiles' of type 'profile type for particular organization'

  • Or: Show 'Profiles' of type 'All'

  • Create as a block and/or page as required. This will show a list of profile ids.

  • (optional) In view editor, add a relationship "Profile: User uid" This will give you access to the person's username and email. Add fields as required eg. mail from user, username from user,

  • Add fields fields "Organization"

  • Add each of the "Hierarchy" fields

  • (optional) add field "Profile: type"

If the fields are shared and appear in more than one profile type, you should see "Appears in: profile2:org_1, profile2:org_2, profile:org_head_office etc. as you select the field to be added.

To group by organization as you outlined, avoid 'grouping and aggregation', and instead select 'Format: HTML list". In the 'format settings' use the 'Grouping field Nr.1 ' to 'Organization'.

Caveat - if someone has more than one profile, they will appear more than once in this list.

If there is just one 'hierarchy' taxonomy reused in all the profiles, then you might be able to add this as 'Grouping field Nr. 2' instead of relying on sorting.

With luck you should end up with a list such as:

Organisation Unit 1:

  • Firstname Surname Heirachy position1

  • Firstname Surname Heirachy position2

  • Firstname Surname Heirachy position3

Organisation Unit 2

  • Firstname Surname Heirachy position1

  • Firstname Surname Heirachy position2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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