Sort Search by List Count

Ok so I have two lists of items.

Likes
Dislikes

They’re both a list of users. I want to sort a post by the number of likes vs dislikes. The most disliked post being at the bottom of the list and the most liked being at the top.

When I attempt to sort, these lists don’t show up as something I can sort by.

I’ve searched the forum but the only topic I found was from 2016 which didn’t help me fix my problem. Could someone help?

I have a lesson that covers this from the perspective of an upvote/downvote counter. (Very similar in premise to likes/dislikes). Here’s a link to the video.

Within search sorting, I do not believe you can sum a list and then use that value as a sort field.

However, you can build in a field that echoes the count of users who have liked (or disliked) the given item. (Basically recorded as “current items like count +1”) within the same workflow that records the like/dislike. (You can use a bulk changes API workflow to clean up your existing data to conform to this).

That should give you the ability to sort based on how you’d like.


Dan (creator of LearnTo - 15+ hours of Bubble tutorials and live coaching)

1 Like

try change which field, or store the like/dislike field on the post itself rather than user. you can have disliked by type user, dislike count type number.
I cant really understand your problem exactly without seeing your data structure.

the likes and dislikes are stored under the post.
The post stores lists of users
likes are a list of users stored in the post
dislikes are a list of users stored in the post

so I am storing the under the post. I did come up with a compromise by adding a “score” which is just a number stored in the post that gets updated with the number of users who liked minus the number of users who disliked.

This topic was automatically closed after 70 days. New replies are no longer allowed.