Tell us what you are trying to do?
Displaying grandchild information on grandparent page with many-to many relationship.
The setup is as follows:
Projects is the grandparent
Partners is the child
Reports are the grandchild
All these post types are many to many relationships. I have created a view that is displayed on the project page(parent). This view lists the related partners. In this view i have created a nested view that displays the reports of the partners.
However the problem is that it shows all the reports of that partner(so also reports from other projects). I need to filter this view so it will only display the reports that belong to the current grandparent.
thank you for your reply. I have included screens from the views setup.
I think i know where the problem is. The system does not know which report belongs to which project. So if i show the partners and the reports that belong to them it shows all the projects of that partner instead of only the ones that belong to that project.
Can i pass the project id to the form that inputs the reports automatically. (So when your in a project you click a button with a url parameter that links to a cred form to add new a new report. See screen 5)
I actually managed to pass the parameter. But i am now facing another issue. I need to be able to filter the view based on these two relationships. So the view needs to only show reports that belong to Project X and Partner Y.
How can i do this, i can only filter on one relationship.
Hi, Shane is on vacation this week so I'm looking in on his outstanding tickets.
I need to be able to filter the view based on these two relationships. So the view needs to only show reports that belong to Project X and Partner Y.
If I understand correctly, you have a View of Partners that is displayed on the post for Project X. That View of Partners is filtered by the Project - Partner M2M relationship, so that only Partners related to the current Project are displayed. Nested inside that View of Partners is another view of Reports. That View of Reports is filtered by the Partner - Report M2M relationship, so that only Reports related to the current Partner are being displayed. However, the problem is this View of Reports shows some Reports that are related to the current Partner, but since that Partner can be related to multiple Projects, so some of the Reports are not necessarily related to the current Project.
Is that correct?
If so, how are Reports and Projects related? Is there a M2M relationship between them directly, or is there an implied, indirect association through Partners? If it's an implied, indirect association through partners, there's not really a simple solution in this case because there is no way to determine which Project-Partner relationship is the ancestor of a specific Report. It is not a true hierarchical grandparent > parent > child setup, because each parent Partner can have multiple parent Projects which are all unrelated to the Reports. In other words, the Report's grandparent cannot be determined in this setup because each Partner can belong to multiple Projects, and the association between an individual Partner and an individual Report is not related to a specific Project - Partner relationship, only to a specific Partner. Each Partner-Report relationship exists independently of each Project-Partner relationship, with no link or hierarchy between these two M2M relationships.