I have a field for “Status” for a Data Type (let’s call it “Orders”).
For order creation I use a dynamic dropdown list pulling options from a Data Type (“Statuses”).
I want to be able to sort an RG by Status but not alphabetically. I first though to create a new field in the Statuses table and assign each status a number 1-5, but I cannot find any way for the RG to sort by this field.
Any ideas of how I can achieve this?
I have the same question. You’d think you could sort by “Orders’s Status’s Name”. However in my app I’m not seeing linked fields showing up as sort options.
Actually, while it may sound counter-intuitive, your most performance-friendly choice here may be to save a numerical value to the Status data type, and the copy that number over to the Order data type whenever the status is changed.
So the statues may look like:
Ordered - 1
Packaged - 2
Sent - 3
And the orders would inherit that:
Order #1 (ordered) - 1
Order #2 (sent) - 3
Whenever you reference a “second” data type, you’ll add a slight bit of loading time to your app, and it’s especially sensitive when applied to rows of things.
You’ll find that some ways to structure Bubble for efficiency do go against traditional database best-practice, but added up, they can make wonders for your app’s performance.
On a sidenote, unless you need to edit the different Statuses in the app itself, I would also consider moving the Status data type away from the database and instead use Option sets. But keep in mind that you’ll only be able to edit them from the Bubble editor.
Thanks for responding.
To the part - admins will need to be able to edit or add statuses without accessing the backend, so options sets aren’t and option.
Can you clarify: are you suggesting putting the sort order numbers within the status name itself? If so, I don’t really want to do that, it looks messy and I don’t really want the average user to see the priority that’s being assigned to each status because certain users will know that they’re tasks aren’t given as high a priority as other.
Is there a way to set the sort order in an RG based on a second field in the status table - there aren’t going to be many concurrent users, so I am not worried about performance.
Create a separate field called Order Number in the Data Type.
Data Type: Status
The user will never see the order number.
I do this all the time for my Data Types that I will need to reference or sort by.