Help needed Sorting Big Tables through Roll up

I’m using Big Tables for both Listings and Reviews. I created a rollup column in Listings to calculate the average rating from Reviews. I need to sort listings by this average rating (for a leaderboard), but sorting isn’t supported on computed columns in Big Tables.

If anyone has any loom or template, it would be a great help.

I think the most straightforward way for me is every time someone submits a review, you have a relation back to the listings and set the average rating (computed) to a basic column.

Some reviews could be imported from the backend so this won’t work.

How frequently does it have to be imported?

That I am not sure, but isn’t there any way to make it dynamic?

Art mentioned something about using JSONata for this on Slack. Are you familiar with that approach?

There might be something in that approach that I’m not aware of, I tried doing this:

  • Join all JSONs in the Reviews table.
  • Construct a dynamic query using JSONata.
  • Get the average rating through Query JSON.

The average rating column still doesn’t show up in the sort options for my collection.

I’m not so familiar with JSONata but could there be a way where we Join all JSONs from the review table in User Profile then get the average rating through some function and return the RowIDs of Listing in an order from highest to lowest, then just make a relation?

Not sure if that’s even possible.

That implies you need to have some sort of a helper table I guess, since an array of rowIDs relating to the Ratings table would just return a list based on the row order of the Ratings table.

I think the helper table could still work. I can show Top 100 Listings and I can use Glide Tables for the helper table since the entire app is built on Big Tables.

Do you know how this approach would work?