Forum Academy Marketplace Showcase Pricing Features

Sorting according to a Thing's Thing field

Adding to this discussion, I’m wondering if it is possible to sort on a Thing’s Thing dynamically.

I put the field name in a custom state that I use to sort dynamically. This works perfectly, but only ‘1 level’ deep. If I want to reference a Thing on the Thing I reference in the RG, the sort doesn’t work. With one data type I just added another two fields with a copy of the referenced Thing’s data as text to help sort the RG but with others this won’t be that easy and it also kind of beats the point of having data across multiple data types.

How does the dynamic field sort work? It takes the name of the field but what if it is not /name but /Thing/name ?

2 Likes

Hello @Bubble Any updates on @vincent56 comment above? Maybe this can be a quick win!

This is unfortunately not a quick win.

Hahaha. No prob :rofl:

What about it in 2020?

3 Likes

Bump - I need this functionality too. The ability to sort a repeating group on a thing’s thing would be super helpful.

The use case: I want my users to be able to sort their tables based on the data in related things of the thing the table consists of. At the moment, they can sort on the fields in the table that are direct fields in the thing, but not linked things.
eg. A PurchaseOrder (thing A) has a Vendor (thing B), and I want to sort the table based on the name of the Vendor. I am not going to put a Vendor name as a text field on the purchase order, as it’s redundant and already stored in the linked Vendor thing.

6 Likes

in the meantime try with nested repeaters

You can achieve this today.

List Sifter’s SORT action does this.

  • Put List Shifter on page
  • Set its “List to Shift” as the list you need to sort.
  • Fire the SORT List Action at it. For “Source Sort List”, just compose the Thing’s Thing’s field.
  • List Shifter’s “Shifted List” output now contains the sorted version of the list.

Example:

Here’s an explorer page demonstrating this basic use of SORT in List Shifter:

And here’s the editor.

6 Likes

Thanks for the suggestions - I’m currently using DragTablePlus plugin to neatly present the tables and will see how to integrate these suggestions with the plugin

Sigh.

1 Like

I just wish that the cofounders had deep technical experience instead of coming from MBA school. I feel like there’ll always be a disconnect between what engineers need and what Bubble thinks it needs.

I’m about 1 or 2 forum threads away from switching to Webflow, they seem to have a better dev community built around them.

I’m still here because I want to like Bubble, as its core UX was promising. But Emmanuel’s unhelpful comments in the forums just displays a total disregard to what their paying customers want.

3 Likes

Dude, List Shifter has a SORT function that lets you put any expression in it. Problem solved. How many times do I have to explain this to people?

ALSO: NEW FUCKING VERSION OF LIST SHIFTER AVAILABLE. Has a SORT Complete event. So now you can tell when your asynchronous SORT completed. :tada:

(RITE HEEERE: List Shifter: Reverse, Rotate, Swap and ITERATE (Loop) Over Bubble Lists | Now at v1.4: Adds Numeric Option, GET INDEX Action)

5 Likes

It’s funny I’ve been trying out the List Shifter, but the UI is a little confusing (one example being that it wasn’t obvious that I needed to set up an action, as I thought that setting the fields in the element was all that needed doing until I looked at your examples).

So maybe you can clarify something for me, or maybe it doesn’t do what I need it to do. I’ve been looking at the examples, and trying to implement it with my own app.

I have a list of things with a to-many relationship (ie, to a related list of things). Let’s use the example of Houses and Paints. Instead of a House having one Paint, let’s assume it has a list.

Now how do I display a list of Houses, sorted by the number (count) of Paints that they use? E.g., House A might use 3 paints, House B might use 5 paints, House C might use 1 paint - therefore my list would display as:

  1. House C
  2. House A
  3. House B

Or a fancier example: https://list-shifter-demo.bubbleapps.io/version-test/mapped-sort-simpler-count

1 Like

But that type House has a one-to-one relationship on Paint.

The example I gave above had a one-to-many relationship (if the Paint field was a list on a House type).

Thanks, but I think I might have to go for the hidden RG option. I just wish there was a more elegant option out of the box with Bubble.

Hello,
Thanks for this solution, I also have a sorting issue with my app. I tried what you suggested but it still doesn’t work…
Basically, I have an RG that contains items, and each item has a field “itemGender” which is a Type “Gender” that I created. The type “Gender” contains the fields :

  • “genderTitle” : “Men”, “Women” and “Both”
  • “genderRank” : 1 (for Men), 2 (for Women) and 3 (for Both).

What I wanna do is to sort my items by gender rank, not descending : so first the items with the gender “Men”, then “Women”, then “Both”.
I tried to sort the items within a dynamic field (now I think it’s called “Change which field…”) :

image

So I’m sorting with : Search for items > itemGender > genderRank (because the dynamic field name must be printable and it can’t be the type Gender), and then I do : “Descending : no”

image

But when I test it, no items are displayed on my page, and the debugger shows this error message :
image
(popular item week is the name of my RG)

I also tried with setting the dynamic sort field at “search for Gender : genderRank” but it shows the same kind of error message :
image

Do you know what’s wrong with what I did ?

Thanks a lot for your answer

1 Like

same error here, @james.k.grover 's trick does not seem to work for me either.

1 Like

Hi guys
Is there any way I could use List Shifter (or any other solution) to sort a RG by a text element which value does not come from the database.
pharma1
I’d like to sort the RG by distance. The distance does not come from the database but from an expression placed in the RG cell.

5 Likes