I'm building a query that has several relationships.
First there are the parent companies (Practice). Each Practice can have multiple locations (Locations). I've created a Parent -> Child relationship between Practices and Locations.
Separate from that, each location (Locations) has multiple physicians (Physicians). The physicians can also work at more than one location, so I created a many-to-many relationship between locations and physicians.
What I would like to do is create a view where I select a Practice in the query filter. Then I'd like the view to display all of the Physicians who work for that Practice.
To accomplish this I created a view that filters out one practice using a Post ID filter. Then I created a nested view that selects posts in a Physicians at Locations relationship that are related to the Post where this view is shown.
Unfortunately this isn't showing me any results. Am I going about this the right way? Is this something that can be done?
If yes I'll share website credentials. Thanks!
Hello,
Since there isn't direct relationship between "Practice" and "Physicians", It needs nested views, for example:
1) Parent post view:
- Query "Locations" posts
- Filter by post type relationship between "Practice" and "Locations"
- In view's loop, display below child post view
2) Child post view:
- Query "Physicians" posts
- Filter by post type relationship between "Locations" and "Physicians"
- In view's loop, display "Physicians" post information
3) In single "Practice" post, display above Parent post view
My issue is resolved now. Thank you!