Skip Navigation

[Resolved] Grouping View results by a field.

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 8 replies, has 2 voices.

Last updated by lesleeM 1 year, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2618165

I have a view set up that shows the following fields:

Ride Contact which pulls from the parent in a relationship between Rides and Registrations
Name which pulls from Registrations
E-Mail which pulls from Registrations

The view is working for how I have it set up now. These fields show in 3 columns in a table. The view can be found here:

hidden link

Our current display can be seen here:

hidden link

What we'd like this view to do instead is to show the first column as a header above the table and then have the table only have the last two columns. And then we'd want to have each Ride Contact only display once and then have all Registrations for that Ride Contact be below that.

So the current results seen on the page linked above would instead show as follows:

Mike Bouvier

Name Email
Michael Bouvier bouvier.mike@gmail.com
Jessica Kinnee jess.kinnee@gmail.com

Kenny Moore

Name Email
Kenny kmjunk@cfl.rr.com
Todd Green tmgreen8365@gmail.com

Athena Bouvier

Name Email
Jeff Scherwin jscherwin78@gmail.com
Michael Bouvier bouvier.mike@gmail.com

Asher Aremband

Name Email
Asher Aremband aaremband@gmail.com

Jessica Kinnee

Name Email
Test - Donna Lyonsdlw@gmail.com

Can you assist with setting it up this way? Once we have this working, we'll try to add a dropdown query filter to the page based on the Ride Contact field. Thanks in advance for any assistance you can provide. This is something that has been requested by one of our Ride Leaders for the Registration/Notifications system we have set up so the Ride Contact can compile a list of all people that have registered for any of his/her rides through the history of the site. We don't have many registrations in there right now because we just launched the site and haven't started to push the registration/notification systems yet. But we expect this will start to fill up considerably once everyone gets familiar with these features being there on the new site.

#2618335

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You will have to use nested views in order to display such structure.

I would like to know are you using classic view or block view.

You should create one view "parent-view-rides" that should be set to query your parent post type "Rides" and display the "Ride Contact" field using this view and then you should create another view "child-view-registrations" and within this view you should add the fields (name and email) and add the "Query filter" for your post relationship and set the option in view.

Then later you should add the "child-view-registrations" into the "parent-view-rides" loop output section.

Here is the Doc that might help you to understand the concept how nested view works:
- https://toolset.com/2015/07/how-to-group-posts-by-category/

If you do not see "Views" menu under Toolset then you should enable the legacy version of the view:
- https://toolset.com/course-lesson/enabling-legacy-version-of-toolset-views/

#2618407

I'm using classic view. I find that easier to work with most of the time. I believe I understand fully what you mean. Let me see if I can do this on my own. More on this after I try this myself.

#2618417

OK, I'm struggling yet again. I'm kicking myself that I just don't seem to be improving at these more advanced requests. I'm doing OK at setting up basic views, but once anything remotely complex gets added to the equation, I seem to be lost and always needing your assistance.

I have the page set up here:

hidden link

I now have a parent view set up here to show the Ride Contact field:

hidden link

and a child view set up here to show the two Registration fields and have the relationship query filter set:

hidden link

I think I'm partially there with this. What I still need is as follows:

1) I tried to set up a dropdown filter in the parent view based on the Ride Contact field, but it didn't work. I tried to emulate how we've done this sort of filter previously and I couldn't figure out how to make that work. The filter needs to show all Ride Contact names in a dropdown. I tried setting it up as a new view called Ride contact dropdown, emulating how we have this done previously with another field. That view is here:

hidden link

I then tried to add that filter using the same approach this has been done successfully elsewhere on the site, but it didn't work. So I'm definitely doing something wrong.

2) I want to only show results after an option is selected on this dropdown. I have custom code that we added to achieve this functionality on a different page on the site using a different view. I think I'll be able to get this on my own by duplicating that code to work on this view. But I don't want to set that up until after I see the step above working.

3) The parent view is showing the Ride Contact field as a header for EVERY ride and then it will show the registrations for that specific ride under the header corresponding to that Ride. Instead, I only want the Ride Contact field to display as a header once, and then the single table below that should show all Registrations for all Rides. There shouldn't be a separate table showing Registrations for every Ride. All of them should be combined into one table.

#2618859

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share problem URL where you want to display the result as well as admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2618937

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As per our support policy, we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery for the issue initially reported with this ticket.

May I kindly ask you to open a new ticket with every new question you may have with new ticket.

I'll split ticket here with your new question and you are welcome to mark resolve this ticket.
=> https://toolset.com/forums/topic/split-grouping-view-results-by-a-field-add-custom-search-for-ride-contact-field/

#2619543

I'm just waiting until we get the split tickets completed before counting this one as resolved. No need to reply to me here on this. I just want to leave it open so I can easily reference it. I'll mark it as resolved once we're done on the other issues that started with this one.

#2619833

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Just cleaning out the queue, you can mark resolve when you can.

#2620213

My issue is resolved now. Thank you!