So I have a repeater group that has it’s ‘type of content’ set to ‘games’.
But i want to ‘sort’ that data by a totally different ‘type’.
here’s the screenshot where you can see my repeatergroup being set to ‘games’ as it’s data type and then on the right, i’m trying to sort it by a field that is contained in a different type (gameworkings). There’s a field in gameworkings called ‘works’ that i’m trying to sort by.
A list is an array. Like, a list composed of the numbers 1 through 5 is:
[1, 2, 3, 4, 5]
If we sorted that list descending by value we’d have:
[5, 4, 3, 2, 1]
You can’t sort a list by a single value. That would make no sense.
Any Bubble datatype (built in or custom — what we call Things) can be either a single value (what I often call a scalar value… a single instance of that datatype), or you can compose a list of such values (a one-dimensional array of such datatypes).
Any field on your custom datatypes can be either a single value or a list.
Further, let us say we have 2 lists: a list of Products like so:
Canned Cat, Mommy Juice, Gizmo
And a list of those Products’ prices (let us suppose for a moment that there is no connection between them) and the prices (in the same order as the Products) is:
2, 10, 1
List Shifter could sort the Products list by the prices list. Suppose we sort by the prices, ascending. Our list of Products would become:
Gizmo, Canned Cat, Mommy Juice
(Because the sorted order of the numbers would be 1, 2, 10.)
I have a database (data type) of games. not a list. its a field called ‘games’ and there’s a 100’000 entries of different game titles.
I then have a completely different data type called ‘gamesWorking’. In this database, i have a field labeled ‘working’.
Users, make submissions via a radio box whether a game ‘works’ or doesn’t work. each time they send a submission, it adds an entry to the datatype ‘gamesWorking’, under the field, ‘works’.
So I end up with a datatype labeled ‘games’ with 100k entries of game titles.
And another datatype ‘gamesWorking’ with a field labeled ‘works’ and entries of ‘Yes’ or ‘No’.
Lastly: i have a repeater group that displays a cell with a Game Name title from the datatype ‘games’ and another cell that counts how many ‘yes’ there is in the ‘gamesWorking’ datatype.
In the repeater group I want the game names that have the most ‘yes’s’ to show at the top of the list, but I can’t sort it by those cells.
This might be way to confusing to write over messages. Screenshot if it helps.
A Search… always returns a list. Search for Games (no constraints) will return a list of all of the Game objects in your database. (I’m sure you know that, but FYI as a baseline).
If you’re trying to sort a list of Games by the number of “working” ratings corresponding to that list of Games, as I’m sure you’ve discovered, it’s easiest if the number of “working” ratings is just a scalar field on Game. That’s the only type of sort that vanilla Bubble can do.
However, if you can construct a list of numbers that corresponds to the Games in exactly the same order, List Shifter can sort your Games by that.
Another (easier) way to do this is with Floppy’s (one of my commercial plugins) “Count Fields/Sort” action. STILL, however, it is best if “Working” were a list of (anything) on the Game object itself.