0

How do I build a staff directory table that displays everyone assigned to a particular assignment? I'm using taxonomy for staff titles and staff assignments.

So in a simple example:

Staff1
- Title1
- Assignment1,Assignment2

Staff2
- Title2
- Assignment1

Staff3
- Title3
- Assignment1,Assignment2

Staff4
- Title2
- Assignment2

Table should be:

| Assignment  | Title1 | Title2 | Title3 |
------------------------------------------
| Assignment1 | Staff1 | Staff2 | Staff3 |
| Assignment2 | Staff1 | Staff4 | Staff3 |
1

I ended up using Views Field View, which allows you to implement a separate view's output per row based on a particular field. Definitely resource intensive. Definitely less than ideal, but it works.

0

Here's what you can do to get quite close to the display you want. I'm assuming that your 'Staff1', 'Staff2' etc are user accounts. If you have a content type 'Staff' and your 'Staff1', 'Staff2' etc are nodes, the following could still be done, but some of the actual choices would be different. You didn't specify, so I'll assume they are actual user accounts.

Create a new view, but on the first page, make sure to select that this will be a listing of 'Taxonomy terms' and go ahead and select the exact vocabulary they should be pulled from (something like 'Assignment' in your case):

enter image description here

Under the 'Advanced' section, add a 'Relationship' to your view. If it is indeed user profiles that these terms are attached to, select the 'Taxonomy term: User using ' relationship. When configuring the relationship, you can select that you want that relationship to be required, if you want to only display users who have an assignment or you can leave it as unrequired if you also want to have a list of all users without an assignment as a group! This will be 'Taxonomy term: Node using ...' if you have a content type for Staff.

enter image description here

Finally, just add 'User: Name' to your view and in the table settings (under 'Format'), select to Group By your 'Assignment'. I'd also then check the 'Exclude from display' checkbox for the 'Assignment' term because it's a little redundant to display it as a column if you're already grouping by it.

enter image description here

In any case... that'll get you pretty close, though you can certainly do some extra css-ing to get it looking prettier.

Hope this helps and at least sets you on the right track...

2
  • So this is pulling the right info, but not displaying how I'd like. Each Assignment has its own table (as opposed to one row for each) and each staff member (nodes, not users) has its own row (Assignment|Name) within that table. Unless I'm doing something wrong here. Thanks for the help. – jay-ess Oct 23 '12 at 20:27
  • Nope, you're doing it right. That's how it's displaying for me too, but I just wanted to get you as close as possible. I would check the 'Exclude from display' on the assignment, as I said above, so it's not duplicated (it's already at the top of the table) and work with css to get it to be more attractive, but otherwise, that's what it should look like... Hopefully this will get you on the right track. – Boriana Ditcheva Oct 24 '12 at 18:59

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.