Tell us what you are trying to do?
I'm trying to show a table that gives an overview of a Company's Activities on a certain (educational) Level.
For an example see attached image.
How should I set this up in order to see this table in a View and be able to filter on it? I was hoping to be able to connect the intermediary type Activity-Level to a Company, but I don't see how.
Hello, in Toolset you have the ability to create many-to-many relationships between two Custom Post Types, not three. You have the ability to set custom field values for the relationship itself (i.e. on the intermediary post type), so I think you could accomplish most of this with a many-to-many relationship between Companies and Activities, and a custom field on the relationship that allows you to select a Level for each connection between Companies and Activities. So for example, you would create a relationship between Company A and Activity 1. In that relationship, you would select the custom field value of Level A. Would that work?
As far as displaying this information, are you hoping to generate something like what you've shown above, or is the spreadsheet pic just to help explain what you want to accomplish? If you want to show something like the spreadsheet pic, can you explain the filters you would like to include? By that I mean are you filtering by properties of the Company or Activity, or just filtering by Level, etc?
I want a table like in the picture to show these values on the site, yes. If that is not possible (or too difficult), I'm open to other ideas.
Well there isn't a GUI available to help generate this table stucture. For the full display, you would create a View of Companies and output the company name in the loop. Then you would separately create a View of the intermediate post type and nest it inside the View of Companies. In the View of the intermediate post type, you would output the title of the Activity parent post type as well as the value of the custom field. So that would produce a display something like this:
Company A
- Activity 1: Level A
- Activity 2: Level B
- Activity 3: Level B
- Activity 4: Level B
- Activity 5: Level C, Level D, Level E
Company B
- Activity 1: Level A
- Activity 2: Level B
- Activity 3: Level B
- Activity 4: Level B
- Activity 5: Level C, Level D, Level E
Company C
- Activity 1: Level A
- Activity 2: Level B
- Activity 3: Level B
- Activity 4: Level B
- Activity 5: Level C, Level D, Level E
If you wanted to produce a table of Activity and Level, you would need to create the markup for that table using custom HTML. To display a check or X for each cell in the table, you would need a conditional that tests whether the custom field for that intermediate post type contains the value for that column.
1. After import of the activities and levels for each company, the levels don't show up in the Company admin view (see image 1). In the admin view of all intermediary post, I can see them and it looks fine (see image 2). How does that work? On a side note: the values of the custom field are stored in checkboxes with strings for both title and value to store (see image 3). When I export I get only 1's. E.g. 1 or 1,1 or 1,1,1. How do I know what values are checked?
2. I want to show the combination of activities and levels on a Company template. When I add a View to show the intermediary posts, the Current Post is Company and not Company-Activity (see image 4). How do I get the values of the intermediary post?
I was thinking of using separate checkboxes for each level instead of one checkboxes group. Some import/export tools have problems with checkbox groups because the data is stored in a serialized format in the database, where single checkboxes are stored in single, separate postmeta values that don't have the same problems. Let me try to set up some similar test cases and see if I can recreate the problems you experienced to offer some guidance. I'll update you before the end of my day today.
I got the problem solved where I can import and show Activities and Level per company.
The next thing that doesn't seem to work is the search box. I use the "Post relationship or repeatable field groups" field to show the Activities. I would need another field of the same type to show the Levels, I guess, but that's not possible. I can however add the Levels, but then nothing shows.
If I understand correctly, you are trying to add a custom search filter to this View. Is that correct? Which post type is chosen in the Content Selection for this View? Normally a View will allow you to filter by the fields, terms, and relationships associated with the post chosen in Content Selection. So if this View is a View of the intermediary post type, then you should be able to add a Level filter here. Unfortunately you would not be able to filter by fields applied to the Activity or Company post type, but the fields applied to the Intermediary post type should be available for filtering. If this is not working as expected, I may need to take a closer look. Can you provide a login for me? Let me know where I can find this View on the front-end of the site so I can run some tests.