Upcoming bug fix to sort order for empty / null items

We just discovered an inconsistency between the way searches sort things and the way the “:sorted” and “:filtered by” messages sort things. Namely, when you do a search that’s sorted on a field, things where that field is empty are sorted to the end of the list (whether the sort is ascending or descending). However, the “:sorted” and “:filtered” messages sorts empty things to the beginning of the list in ascending mode, and to the end in descending mode.

We definitely want sorting to work consistently throughout Bubble, and will be changing the “:sorted” and “:filtered” messages to match the behavior of searches; ie, empty fields always sorted last. As well as the inconsistency being confusing, we need them to work identically in order to implement some performance optimizations to querying that we are building.

However, given that this fix could theoretically break apps that are relying on the buggy behavior, I want to check to see if anyone has use-cases that this would break before rolling the change out. Assuming there aren’t issues with this, we’ll likely roll out the fix tuesday or wednesday next week.

2 Likes

Go Ahead. We will fix apps as needed. May I suggest that since many of the users don’t check the forum regularly that an ail alert goes out for these kind of fixes before they happen and the date/time it would occurred so we can alert our users accordingly.

Thanks

5 Likes

Hi Josh,
I don’t have any application that rely on this behaviour. That said, my initial thought would have been that every sort should behave as you describe for :sorted and :filtered, i.e. an empty field would appear first in ascending and last in descending.

Alex

There seems to be another issue (bug?) here.
If the field to sort by is “a thing”, then Bubble sorts the result set by the thing’s unique ID instead of by the field declared in that thing as its primary key (which is usually the thing’s name).

Hey @alex5 , thanks for reporting that. Right now marking a field in the App Data tab as a primary field only affects the App Data panel and its import / export features. It doesn’t have any effect on the run mode behavior of the application. I think the issue here is that “thing” fields are showing up in the sorting list at all… I’d rather keep them hidden until we do offer a way to sort on sub-fields of things (this would be a fairly substantial feature to build, so unlikely to do it in teh short term). I’m going to investigate whether or not there’s a good reason why we’re showing them, and if not, hide them.

Hi @josh,

Thanks for the quick reply. I hear you, but imho I think you guys will need to solve this. Not seeing foreign key fields when trying to manipulate a table is rather annoying (cf. the Excel plugin!).

Usually, FKs are used to group and filter records, so it would be great if Bubble allowed us to do precisely that.

I have no idea of how complex this would be but maybe you can offer for the sort fields the same capabilities that Bubble has when it let’s you (I’m going to call it) “navigate” through fields.

sort by: fk_field**'s Name**

where Name is a field in the foreign thing instead of the unique ID field of that thing.

(Is this what you meant by a fairly substantial feature to build?)

Let me know if I can be of any help, and thanks for a great product,