Forum Academy Marketplace Showcase Pricing Features

RG sorting of posts by upvotes minus downvotes?

I’m trying to sort a list of posts by popularity in a repeating group. This popularity is based on the number of upvotes minus the number of downvotes. Unfortunately, I can’t see how to sort the RG by this simple calculation as I only see the sorting option for the actual fields (upvotes, and downvotes etc).

I really don’t want to have to add the calculated field in the database that is also changed whenever an upvote/downvote is done. So is there a better option?

Thanks!

Great question! Unfortunately sorting by multiple fields is not possible at the moment, so your best bet may have to be adding a “popularity” field to your database that calculates the upvotes - downvotes. I apologize for the limited action I can take here as I understand you mentioned this is not ideal. If you have any other questions feel free to email us at [email protected] - we’re happy to help where we can!

I know what you mean - I haven’t found a way to sort by a calculated field either on the UI. The work around I do is to use a backend workflow to go and populate the calculated field on the database - and I kick that workflow off as soon as the user enters the page/show group.

From a User experience the updated fields and sorting seem “realtime” as it quick/subsecond.

Ok thanks for clarifying. I just wanted to make sure that this was the case before doing it a different way.

Yes, I’m just going to have to do it the way I mentioned. In my case, there’s only 1 place where these fields are updated so I’ll just add that to the voting workflow directly. I like your idea of kicking off workflows though for more complex calculated fields :+1:

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