This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Hi. I'm opening up this "mess" to see if we can get it to work! I'ved worked with Beda on this ticket:
[Closed] Displaying Custom Fields in Search Results in a Many to Many setup opened on July 18, 2017
I've built a query page for my client (hidden link) where we want to see a list of machines (custom post types) filtered by the content in custom fields. As you can see in the attached screen shot in PM1.png, all the data shows except the company name and the ownership type. In screenshot PM2.png, you can see the Loop code in the view. i've made changes and redone it so many times but it still isn't working.
This is a many to many relationship. Companies are parents. Contacts are children. Ownership are children. Products (machine) are parents. Ownership are children of the Machines. Each machine is owned by a company, hence the query.
From your question it looks like your many-to-many relationship looks like this:
Companies Machines
\ /
\ /
Ownership
Your View is querying and displaying Machines.
You want to output content about the linked Company.
Your problem is that the information about post relationships is stored on the child, so the linking Ownership post knows which Company owns which Machine, but the Machine knows nothing about the relationship and the Company knows nothing about the relationship. You can go up to grab fields from the parents, not down to get them from the child.
The solution here is that you need to add a nested View where you want to output the company info.
So you create a View which returns Ownership posts that has a post relationship filter to show ownership posts that are children of the current machine. Then in the Loop Output section of this View, that is where you can use the id attribute to output fields not from the ownership post but from the parent Company.
You then insert that View in the Loop Output section of your original View where you want the company field to appear.