Skip Navigation

[Resolved] Showing table of data from many-many relationship

This thread is resolved. Here is a description of the problem and solution.

Problem:

Display posts of Intermediary post type as a HTML table.

Solution:

It is possible within Views plugin, for example:
https://toolset.com/forums/topic/showing-table-of-data-from-many-many-relationship/#post-1175799

Relevant Documentation:

https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

This support ticket is created 6 years 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#1175415
Parameter_edit.jpg
entity_edit.jpg
parameters.jpg
entities.jpg
relationship and fields.jpg
dashboard post types.jpg

Tell us what you are trying to do?
In a post, have a view containing a table of parameters that belong to an entity (pls see below explanation and question at no. 6)

1. Created two custom posts, 'entities' and 'parameters'
2. Created many-to-many relationship: Entities [*] << Entities Parameters >> Parameters [*]
3. Created custom fields for this relationship (data = number)
4. Created a bunch of parameter and entities (see parameters.jpg and entities.jpg)
5. Added parameter data to entity post (see screenshot entity_edit.jpg or paramater_edit.jpg)

6. Trying to create a view with a table that will show on post entity, the parameters assigned to it. This table should have the same layout as screenshot 'entity_edit.jpg', ie 1 parameter per row, and then a bunch of parameter values in the columns. I'm trying to follow https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items but no luck.

Pls let me know if this is possible with toolset and how I go about it.

Would be nice if this were in a tutorial site (as far as I can see there is no tutorial site with many-many relationships?)

Is there any documentation that you are following?
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

What is the link to your site?
None - running on home server

#1175799

Hello,

It is possible within Views plugin, for example, in a single "entities" post, you can try these:
1) Create a post view, query posts of Intermediary post type "Entities Parameters"
2) Filter by:
Select posts in a entities parameters relationship that are related to the Post where this View is shown.
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items
3) in section "Loop Editor", click button "Loop Wizard", choose option "Table"
https://toolset.com/documentation/user-guides/view-layouts-101/?#table
and display the parameter field values (parameter 1 min, parameter 1 max ...) + related "parameter" post information

See the document you mentioned above:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-one-related-item-parent
section "Displaying one related item"

#1176352
view_parameters_per_entity_3.jpg
view_parameters_per_entity_2.jpg
view_parameters_per_entity_1.jpg
entity_two_parameter view.jpg
entity_two_parameter values.jpg
entity_three_parameter view.jpg
entity_three_parameter values.jpg
entity_one_parameter_view.jpg
entity_one_parameter_data.jpg

Thank you for your assistance.

I have created views according to your instructions and attached screenshots of my results. However, this is not the desired result yet.

The view is creating the tables with the correct amount of columns and the appropriate parameter post titles. However, it is not showing data for parameter min and max value.

Pls see attached screenshots showing:
- parameter data from within the entity post editing screen
- view config
- screenshot of the view within an entity post

What do i need to do to show the actual data in the view?

Please note that the parameter min/max values are custom fields for the relationship entities<>parameters. I.e., several entities can share one or more parameters, however each entity will have unique parameter min max values.

#1176672
ip.JPG
names.JPG

As I mentioned above, you need to query posts of Intermediary post type "Entities Parameters", please try these:
create another many-to-many relationship between post types "Entities" and "Parameters", for example "Entities Parameters 2", in the "Relationship Wizard", step "Names", enable the option "Intermediary Post Type visible in WordPress admin menu", see screenshot names.JPG.

Then you will be able to create a post view, and query the Intermediary Post Type "Entities Parameters 2", and display custom fields values of it. See screenshot ip.JPG

#1176741

Thank you that did the trick!

#1176743

My issue is resolved now. Thank you!