I’m having trouble using fields of nested field collection items in Views. If a field collection item isn’t nested within another field collection item, then I can get its fields displayed by views no problem (by creating a views relationship as explained in this Drupal Stackexchange page on integrating Field Collection Module in Views), but I can’t get it to work if the field collection item is nested within another field collection item. Here’s my example:
I have a content type with a field collection item called “Job.” “Job” has two fields in it, both of which are also field collection items, “Job Info” and “Equipment Info”. “Job Info” has two text fields, “Job Name” and “Job Date”, and “Equipment Info” has a text field called “Equipment Name”, and an integer field called “Equipment Value”. This pic illustrates the fields: http://i1102.photobucket.com/albums/g455/FilmSnob718/Drupal%20Question/F...
My goal is to have a view that simply lists all the individual equipment values:
Value: $500,000
Value: $300,000
Value: $235,000
Value: $160,000

When I set up this view as pictured in this screenshot http://i1102.photobucket.com/albums/g455/FilmSnob718/Drupal%20Question/V... the values in the view are blank and there are an incorrect number of them (3 instead of 8). The view ends up looking like this: http://i1102.photobucket.com/albums/g455/FilmSnob718/Drupal%20Question/V...

My hunch is that I need to create a second relationship in the view, but it’s still not working after trying lots of relationship combinations. To make things more illustrative for myself and others reading this post, I have set up a live mock site with this example (which I hope to maintain indefinitely for the benefit of others) at www.shakespeare79.byethost31.com/ feel free to login with the username ‘helper’ password ‘drupal’ to edit the view if you know how to get it to work. (Let me know if an additional module needs to be installed in order to achieve the task and I’ll install it). Thanks!

Comments

elblufer’s picture

Your post contains some items that can't be seen. I have limited experience with Field Collection, so I'm not sure if I can help, but I thought I'd mention this module in case you're not using it.

http://drupal.org/project/field_collection_views

valiant_falstaff’s picture

Thanks for the response. Unfortunately I'm running into the same problem with the Field Collection Views module. This module transforms a field collection item into a view. "Great," I thought, "I'll just turn the field collection items into views and exclude all the fields from the display except for the Value field." The problem is that when I turn the "Job" field collection item into a view and turn the nested "Equipment Info" field collection item into a view, changes to the "Equipment Info" view take no noticeable effect. The "Job" view can be altered no problem, but it seems that if a view is nested inside another view, the output cannot be altered in any way no matter what changes you make to the view.
My next thought was to turn only the "Equipment Info" field collection item into a view (which does not result in the same problem as above: changes to the view alter the output as expected since the view isn't nested within another view) and then create a view of a view using the Views Field View module. But when I do this I run into the exact same problem as the original issue: the view of a view shows up blank. It literally looks exactly like the original non-working view: http://i1102.photobucket.com/albums/g455/FilmSnob718/Drupal%20Question/F... My hunch is that this view can work without the Field Collection Views module or the Views Field View module, it will just require the correct relationships within the view, so if anyone knows how to do this please login to the mock site mentioned in the original post. Thanks!

valiant_falstaff’s picture

This issue has been solved by jnorell and and the solution has been documented at https://drupal.org/node/1936620