# Sorting SQL data by user‑specific Distance column

**URL:** <https://community.glideapps.com/t/sorting-sql-data-by-user-specific-distance-column/85724>\
**Category:** Ask for Help\
**Created:** [December 15, 2025, 4:15pm UTC](https://community.glideapps.com/t/sorting-sql-data-by-user-specific-distance-column/85724 "2025-12-15T16:15:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mateo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mateo/32/79814_2.png) [@Mateo](https://community.glideapps.com/u/Mateo)\
**Post date:** [December 15, 2025, 4:15pm UTC](https://community.glideapps.com/t/sorting-sql-data-by-user-specific-distance-column/85724/1 "2025-12-15T16:15:59Z")

</div>

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?

**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!

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [December 15, 2025, 4:51pm UTC](https://community.glideapps.com/t/sorting-sql-data-by-user-specific-distance-column/85724/2 "2025-12-15T16:51:05Z")

</div>

😕 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.

---

<div class="post-metadata">

**Author:** ![Mateo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mateo/32/79814_2.png) [@Mateo](https://community.glideapps.com/u/Mateo)\
**Post date:** [December 15, 2025, 5:03pm UTC](https://community.glideapps.com/t/sorting-sql-data-by-user-specific-distance-column/85724/3 "2025-12-15T17:03:11Z")

</div>

Hi @Robert_Petitto, thanks for the reply

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

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [December 15, 2025, 5:15pm UTC](https://community.glideapps.com/t/sorting-sql-data-by-user-specific-distance-column/85724/4 "2025-12-15T17:15:12Z")

</div>

Nope, it shouldn’t!

---

<div class="post-metadata">

**Author:** ![Mateo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mateo/32/79814_2.png) [@Mateo](https://community.glideapps.com/u/Mateo)\
**Post date:** [December 15, 2025, 6:51pm UTC](https://community.glideapps.com/t/sorting-sql-data-by-user-specific-distance-column/85724/5 "2025-12-15T18:51:55Z")

</div>

noted, quick question @Robert_Petitto

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

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [December 15, 2025, 6:55pm UTC](https://community.glideapps.com/t/sorting-sql-data-by-user-specific-distance-column/85724/6 "2025-12-15T18:55:51Z")

</div>

Check out this tutorial starting at 14:25

[![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/a/ea5efb694429220400288978917de8bf1457c961.jpeg "Glide 101: EVERYTHING You Need to Know About Call API and Query JSON") ](https://www.youtube.com/watch?v=7F4e9JatqeM)

---

<div class="post-metadata">

**Author:** ![Sean\_Page](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sean_page/32/77424_2.png) [@Sean\_Page](https://community.glideapps.com/u/Sean_Page)\
**Post date:** [December 16, 2025, 3:40pm UTC](https://community.glideapps.com/t/sorting-sql-data-by-user-specific-distance-column/85724/7 "2025-12-16T15:40:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [December 23, 2025, 3:40pm UTC](https://community.glideapps.com/t/sorting-sql-data-by-user-specific-distance-column/85724/8 "2025-12-23T15:40:20Z")

</div>

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