If I have a list of things stored in my DB, in a specific order, and there is no way in my app to change that order, can I assume the default order will always be in the original order that it was set?
E.g. Fruits, in the order: Apple; Banana; Grape; Orange.
I’m trying to understand if I can rely on the integrity of that list to always show in a default order, or if I need another solution (such as a row for each Thing, and an order number).
Its probably best to have an order number. As if something happens to that row, or you want to reorder it later, its not easy. I’d suggest having bigger intervals like 10, 20, 30, 40 than just 1,2,3,4. In case you want to slide another row in there later.
Sorry I should have explained a bit further… I’m not currently using Things, that was my suggestion as a worst case.
What I have is a Data Type: Person, with a field ‘favourite_foods (list)’. When a user registers, this is blank.
My UI allows them to choose up to 4 foods, and specify the order. Using ListShifter - they can swap out foods, or reorder their preferences.
Is this approach robust, or is there a scenario where Bubble may reorder the list?
Scenario: Bob signs up and chooses/saves: 1. Beef, 2. Chicken, 3. Lamb, 4. Pork. Can I guarantee that this list will always be in this order if Bob was to return later to update?
A list stored in a list type field on a Thing will retain its order. You can change the order of course by applying :sorted. But if you have a Thing and you simply reference a field on that thing that holds a list, the items in that list are, by default, in the order in which you wrote them to the field.
Very helpful, thanks Keith!!