Forum Academy Marketplace Showcase Pricing Features

Sort By list of items:count in Repeating Group

Hi All,

Need assistance trying to sort a repeating group by a list of items:count

I have “Driver” type and each “Driver” has a list of “Driver_Violations”
When I display this in a simple repeating group I am getting the data I want, however, I cannot seem to sort the list by “driver_violation” count. I need it sorted with most violations decending. I have tried a dynamic field to search but no luck so far. this is how it is currently displaying:

image

This is the Driver Database table:

I see a lot of Bubblers with the same issue and yet there doesn’t seem to be a solution.
I could create another field with a number type and add up, problem is I need to then also filter it by daily, weekly, monthly so a static number field won’t work for this.

Any help appreciated

So no way to sort a repeating group by a types list of things count?

So How would it work if you were creating a app with list of teams who each had a list of matches and you want to display in descending order the teams with the most matches ?

Hey @rosewaterbrands :wave:

I was able to get this to work the other day.

Try doing a search for Driver Violations (filter by the driver maybe?) group by violation type, or driver, depending on what you are trying to do, aggregate the count amount, then you can sort it by the count.

It really just depends how you have the Driver Violations dataType set up.

Sometimes it just takes a little bit of thinking outside the box to get it to work. :blush:

We have a blog post on our Paid Membership eLearning Hub that has an example that you can look at here: Sort By List of Item’s Count or Sum

Hope that helps! :blush:

@j805 www.NoCodeMinute.com

For All Your No-Code Education Needs:

Nice! I learned something new here. Are you aware of any other scenarios where native Bubble can sort on a calculated field, or is this it?

Yeah, it’s pretty cool. @ed727

What other things are you trying to do?

I don’t need to calculate anything at the moment, but this question (some variation of “how can I sort on a calculated field?”) comes up on the forum from time to time and the answer is usually to use a plugin.

1 Like

@ed727 yeah. I have used the plugin in some rare cases but mostly I try to avoid the plugin.

I’m just glad I finally understood how to do it without the plugin. It was such a relief and easier than I had thought. :blush:

1 Like

This might help

This thread was helpful thanks - I had a similar problem and this solved part of it.

The question I have is what happens to the Drivers with 0 violations? In my case (I’ll use same examples used above) they get filtered out in the original search for Violations but I would still like to display the Drivers as the repeating group is more about displaying various Driver info and not just one column.

My data is set up so that there is a Driver field in the Violation data type