I''m attempting to create a view that shows a parent node with some fields from each of it's children. In doing so, I'd like to group by 3 fields from the parent. For example:

Event 1:Description:Photo
-- Presenter 1
----- Presentation1
----- Presentation2
-- Presenter 2
---- Presentation4
-- Presenter 3
----- Presentation10
----- Presentation21

My initial thought was to create a table view and group by these fields. However, I don't see a way to group by multiple fields. Is this possible? Should I look at another approach?

Comments

marta_yo’s picture

I too am interested for a solution...

mbinz’s picture

Subscribe

ratebz’s picture

Subscribe

mherchel’s picture

drjonez’s picture

Sub

tomdisher’s picture

Subscribing - If you find a different solution please let us know.

My desired outcome is as follows:

Country1
- State1
City1
City2
City3
- State2
City4
City5
City6

Country2
City7

Pucca’s picture

Has anybody came up with a solution for this? I also desperately need to know.
I've got:

FIELD 1
----FIELD 1.1
-------entry
-------entry
-------entry
-------entry
----FIELD 1.2
-------entry
-------entry
-------entry
-------entry
----FIELD 1.3
-------entry
-------entry
-------entry
-------entry

fildawg’s picture

I used the Views Field View module http://drupal.org/project/views_field_view to nest a view within a view.

Pucca’s picture

Thanks. do you perhaps know of a tutorial? or a video of how it works?

fildawg’s picture

Don't have a video or tutorial. However, it was pretty easy.
1) Create a view of the 'sub-content'
2) Create the outer content view and select the field Global:View

vglocus’s picture

I was looking for the same thing for a long time till I came across this thread.

I have a series of statements (nodes) which are indexed using a hiearchical taxonomy. Nodes can have several terms but only on the third level. I wanted a view like this:

1
(desc 1)
-1.1
-(desc 1.1)
--1.1.1
--(desc 1.1.1)
---statement 1
---statement 2
-1.2
-(desc 1.2)
--1.2.1
--(desc 1.2.1)
---statement 3
--1.2.2
--(desc 1.2.2)
---statement 1

Note how statement 1 is supposed to come up several times. I also have descriptions of terms on several levels of the taxonomy.

This is how I did it.
Step 1:
I created a sub view (type term)
Relationships: Taxonomy: Node
Arguments: Taxonomy: Parent term
Fields: Taxonomy: Term, Taxonomy: Term description, Global: Custom text [cluster term and desc to group by], (node) [whatever content or attribute from node you want]
Filter: Taxonomy: Vocabulary
Group by: Global: Custom text

Step 2:
I created the view which is to be shown (type term) and needed the views_field_view module and token.
Relationships: Taxonomy: Parent term
Fields: (parent) Taxonomy: Term, (parent) Taxonomy: Term description, Global: Custom text [cluster parent term and desc to group by], Taxonomy: Term, Taxonomy: Term description, Global: Custom text [to add <h3> tags around term and desc, for styling only], Taxonomy: Term ID [excluded and used as argument for Global:View], Global: View [choose the sub view from step 1 and the term id as argument]
Filter: (parent) Taxonomy: Term ID [enable only the top terms]
Group by: Global: Custom text [the first one]

Step 3:
With some minor css styling I was able to make it look nice to :)

I hope this helps. I took me some time to figure out but now it feels like a very simple solution.

nplowman’s picture

Using views_field_view to make a nested view worked for me.
My view needed to look like this:

Term A
Term 1
--Node
--Node
--Node
Term 2
--Node
-- Node
Term B
Term 1
--Node
--Node
Term 2
--Node
--Node
etc.

It gets a little complicated and requires a combination of arguments, relationships, etc, but it can be done!

tfrech’s picture

I stumbled across this post in a search for a solution to the same problem. I tried some of the suggestions and found they didn't quite meet my needs. I then discovered that it is simpler than I thought:
Create a field for group level 2 and exclude it from display. Rewrite its value if necessary to make it look how you want it.
Create a second field, for group level 1. Rewrite its output as:

[field_1]<br>
&nbsp;&nbsp;[field_2]

Now all you need to do is set your view to group on that main field ([field_1]). It will group on the entire contents of the rewritten value so when field_2 changes, the group change.

You end up with

Field1
Field2
Your view contents....
Field1
Field2
Your view contents....

tomsm’s picture

@tfrech
Thanks for the tip ! This helped me a lot.

etibmw’s picture

hi all
i need to create something similar to what you are all working on.
i have data of nodes with three fields
the first is the sale number
second country
third category

i get the sale number from the url (no problem there)
and show the country category. what i get now is

USA
new york
USA
new york
USA
Boston
France
Paris
France
new york

what i want is:
USA (3)
new york (3)
France (2)
Paris (1)
new york (1)

how should do this?
if i use argument summary i only see the country and not the category...
what is the best way to do this?
thanks
eti

danepowell’s picture

Thanks for the tip- can't believe I overlooked this 'simple' solution!

agileadam’s picture

@tfrech, thank you! This solution is pretty interesting and works great!

mlachance’s picture

After hours searching for a solution to this problem, your post was really helpful. Exactly what I was looking for. Many thanks.

kpv’s picture

Thanks! Wouldn't even think of such a solution. That's strange that it works :) Obviously, need to dig deeper into views to understand it )

patoshi’s picture

hi any new developments on this type of recipe? I mean the nested views works great but once u go above 3+ views its a bit of a pain to manage. I'm looking to get an output like this: http://prntscr.com/4fvu2 --- but would be great if it just involved 1 view instead of 3.

patoshi’s picture

actually views_field_view doesn't work for what i need...

I'm trying to figure out how to get this type of views output: http://prntscr.com/4l2es

Month 1
-Day 1
--Event 1
--Event 2
--Event 3
-Day 2
--Event 1

Month 2
-Day 3
--Event 1
--Event 2
----------------

Right now i can only get to group by Month by using the PHP field and just converting the date fields into just month-year and just grouping by that. Which results in this: http://prntscr.com/4l2kw

But the problem with that is that the DAYS are not being grouped together. It just shows each row individually. anyone have solutions to something of this nature?

if i were to write a script for this, it would basically be

1. query for all months that has events.
2. and within each month do another query for the days that there are events.
3. now i would query each one of those days and list out all the events for those days.

In effect its 3 queries thats needed. I'm not sure how this can be done in views.