Sorting SQL data by user‑specific Distance column

Hi everyone,

I’m running a residential cleaning business in 6 different cities, and we use Teamup as our main scheduling tool. As we grow, manually assigning jobs has become impossible, so we’re moving to a more “Uber‑like” model where cleaners can claim available jobs directly in our Glide app.

To support this, we consolidated all available jobs from all 6 cities into a single external SQL table (Supabase) that is connected to Glide. Initially this looked like the best approach compared to Glide’s native tables, but we’ve hit a limitation around sorting.

In the external SQL table, each job has a client address. In Glide, I created a computed column called location_distance that calculates the distance between the client’s address and the logged‑in user’s address/current location. The value is therefore user‑specific and changes in real time for each user.

Here’s the problem:

  1. With SQL sources, it seems that collections can only be sorted by “real” SQL columns, not by Glide computed columns like location_distance.

  2. Because location_distance is user‑specific, Supabase has no way to know which user is logged in, so I can’t calculate or sort this distance server‑side either.

So my questions are:

  • Is this behavior (no sorting by computed / user‑specific columns when using external SQL sources) expected?

  • Has anyone found a practical workaround to sort a list of jobs by per‑user distance when the base data lives in an external SQL table?

    • For example, patterns using user‑specific columns, temporary Glide tables, or any other tricks that work reliably in production.

In case there is no viable solution using a SQL table, I was thinking on synchronize the SQL table with a Google Sheet table and connect this Google Sheet table to glide, but I’m not sure if the limitations would be the same for a Google sheet table?

Any guidance, patterns, or examples would be hugely appreciated. Thanks in advance for your help!

:confused: You’ve reached one of the limitations with SQL and Glide. It’s the same for their Native Big Tables. You can’t sort a collection by any sort of computed column, save for simple math or rollup columns that directly reference a raw number.

Hoping that 2026 brings some improvements to this limitation.

The only workaround that I’ve seen in the past is using a helper table that joins the record id and distance column using JSON. A Query JSON to sort the JSON object by distance, a helper table that parses out X number of records from the helper table, and then a relation from the helper table back to the listing records. Then, you display that helper table as a list instead of the actual records with the action of view detail screen → relation instead of this item

No easy task, but possible.

Hi @Robert_Petitto, thanks for the reply

Do you know if this limitation happens with google sheet as well?

Nope, it shouldn’t!

1 Like

noted, quick question @Robert_Petitto

How do you recommend parsing the records from the query JSON to the helper table?

Check out this tutorial starting at 14:25

4 Likes

If you are using an external table, the easiest way to get around this is to just create views and then relations back to the main tables for editing. It’s a bit annoying because you always need a view for every table, but it also gives you the ability to filter, group, sort etc without any other issues.

**You would most likely need a “location” table that could be written to from the user side “log location” and then calculate that on the server side in the view providing user specific location via employee id or email or whatever that could be filter and/or row owner

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.