Say I have a table of product review scores that looks something like this, in descending order of creation - so the latest is at the top:
Prod | Score
XYZ | 5
ABC | 4
ABC | 2
XYZ | 3
XYZ | 2
ABC | 4
Now what I want is to retrieve a list of products where the last N reviews for the product were positive, which we should take to mean 3 or higher (to keep this simple let’s assume that this number is always 3). On the other hand, for our example, let us assume that N is 2 but that this needs to be dynamic, i.e. is to be specified by the end user or retrieved from the database. So, based on our value of 2 in this example, we should retrieve only XYZ since its last two scores are 5 and 3 while for ABC they are 4 and 2 so ABC is excluded.
How would you do this? I’m finding that the inability to do custom sorting on a group-by in Bubble is making this rather challenging and I haven’t found a way around it.
A few things to note:
- Please feel free to recommend additional columns/tables to achieve a solution.
- Ideally, the solution will not be dependent on a RG as I may need to do this from the server as well. That being said, I would be grateful even for a RG-based solution at this point.
- Efficiency and performance will be important but again, I would appreciate anything that works at all in the first instance. In other words don’t let performance concerns get in the way of a suggestion.
I hope that I’m missing something simple or obvious here as I have been off Bubble for several months and may be a little rusty.