I am using Views Field View module. I need to filter the child view using the parent field. Can anyone experienced in it please share.
2 Answers
You will have to send a contextual filter from your parent view and catch it in your embedded view. There are plenty of tutorials on contextual filters, but this one should get you started: http://www.metaltoad.com/blog/using-drupal-contextual-filters-views
UPDATE you can set a contextual filter from your parentview by editing the embedded view in 'fields' and define it in the view-settings drop-down.
As I had a lot of trouble setting context filters properly for Views Field View, and couldn't find any documentation on the subject or proper answers, I'll provide more detailed walk-through here:
I want to have a list generated like this from different content types:
- First group of things
Some data about that group
- name of first thing from that group
- name of second thing from that group
Second group of things
Some data about that second group
- name of first thing from the second group
- name of second thing from the second group
- I've created parent view "my_group_of_things" showing fields from content type "my_group"
- I've created child view "list of things" showing fields from content type "thing"
- The content type "thing" has a field ("field_my_group") of type node reference that references to selected "my_group" and has a label "Content: MyGroup"
- In parent view ("my_group_of_things") I add field Content: Nid
- In the same parent view I add field Content: View and set it to "list of things"
- While setting the Content: View field I enter [!nid] in the CONTEXTUAL FILTER text box
- Don't forget to apply the Content: View and save the View
- In child view ("list of things"), in ADVANCED tab, I add a CONTEXTUAL FILTER
- While setting this contextual filter I choose Content: MyGroup (field_my_group)
- In the same contextual filter I set WHEN THE FILTER VALUE IS NOT AVAILABLE to "Hide view"
- Apply and save. It should work now.
Very simple, but without documentation and arrogant answers like "yeah, i got it now", or "just set up contextual filter" it took me a whole day to figure out.