Forum Academy Marketplace Showcase Pricing Features

Sorting a repeating group based on Number of likes

Can anyone help me with How to Sort a repeating group based on the number of likes?

I have added the users to a list to calculate likes and to display them but I couldn’t figure out how to sort them.

Hi @nandyuiux ,

I assume you have a list of users attached to the thing they liked (ie product → list of users) and you want to display a repeating group of products sorted by “list of users:count”.

If this is the behaviour intended, I’d suggest you add another field “nb of likes” to your product thing which would be updated any time a user is added to / removed from the list (ie nb of likes = list of users:count).

This way you’ll be able to use this field to sort your repeating group and it’ll be way faster than calculating it every time.

Best,

Arthur

1 Like

Thank you, It worked. I have added a new field

But I have a problem. When I apply the filter First, it sorts Products with the most number of likes which has current user and then sorts the remaining products after that.