Sort repeating group by field

I have a type called “Address” which contains a geographic address field in addition to a number of other fields.

I have a type called “Listing” which has a field for the aforementioned “Address” type (i.e. Listing->Address->geographic address)

I have a repeating group of type “Listing”.

I would like to sort the listings in the repeating group by distance between some location and the listing. In other words, I want listings that are closer to the location at the top of the repeating group and listings that are further away from the location at the bottom.

Unfortunately, it doesn’t seem like I can sort my “Listings” by the geographic address field of the “Address”.

Any idea what I might do?

https://www.nocodeboss.com/detail?recordId=recDooKORYsx3AIKE

Is there a field for “linked listing” on the “address”?

You could make the RG data source “Do a search for addresses (sorted by distance from current location): each item’s listing”.

There’s another way to do it but it involves a lot of “Do a search for…” which is slow and with Bubble’s upcoming pricing change, expensive. I’d recommend restructuring your database to allow for the above to work.