# Query with random sort?

**URL:** <https://community.glideapps.com/t/query-with-random-sort/78032>\
**Category:** Ask for Help\
**Tags:** computed-columns, query\
**Created:** [November 19, 2024, 9:05pm UTC](https://community.glideapps.com/t/query-with-random-sort/78032 "2024-11-19T21:05:17Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [November 19, 2024, 9:05pm UTC](https://community.glideapps.com/t/query-with-random-sort/78032/1 "2024-11-19T21:05:17Z")

</div>

I’m not sure if I’m missing something but can anyone confirm whether you can run a query and select the sort type as random? I’m not seeing this option.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [November 20, 2024, 1:01am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/2 "2024-11-20T01:01:53Z")

</div>

What’s your use case for this? I guess if you’re displaying it on the front end, then you can sort randomly on the front end?

---

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [November 20, 2024, 2:46am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/3 "2024-11-20T02:46:48Z")

</div>

Ok, if that’s the only way… With this method I have to set a large query limit to make it work as intended because it only randomizes the queried items according to that limit.  
I find it strange that the query function allows sort by table order but neglects random. This means we actually have to set the sort twice to achieve what we want. Weird.

---

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [November 20, 2024, 3:56am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/4 "2024-11-20T03:56:31Z")

</div>

> [@ThinhDinh](#):
>
> What’s your use case for this?

I forgot to reply to this part. It is for a collection of suggested products that I include at the bottom of a certain product’s detail screen. The query enables me to avoid suggesting the same item that is shown on this detailed screen but in “Sort By” I want to choose “Random”, which is strangely omitted from the options.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/a/4ab8b6e02cb27b65c304399eff8a26c031942f22.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/b/dbde6c6c333a6141fb0b9fc29266c09ebaf2273a.jpeg)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [November 20, 2024, 4:12am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/5 "2024-11-20T04:12:35Z")

</div>

Couldn’t you skip the query and directly show a limited collection sorted randomly? You can set a filter to not show the current screen item. I think the query is unnecessary in your case.

Or you could use a relation is instead, which has less overhead, and still handle your sorting and filtering on the front end.

---

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [November 20, 2024, 4:20am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/6 "2024-11-20T04:20:02Z")

</div>

> [@Jeff\_Hager](#):
>
> directly show a limited collection sorted randomly? You can set a filter to not show the current screen item

I didn’t see this filter option? Where do I set it?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [November 20, 2024, 4:22am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/7 "2024-11-20T04:22:16Z")

</div>

![1000003841](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/b/db1b09608e9edddce23fa31b26f43998277088a8.jpeg)

---

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [November 20, 2024, 4:24am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/8 "2024-11-20T04:24:07Z")

</div>

Why don’t I see it? Did you click on the collection or somewhere else?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/7/b77c7a4126c2ce550dfa73c2d5dc57cf9b0ee471.png)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [November 20, 2024, 4:28am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/9 "2024-11-20T04:28:07Z")

</div>

Are you showing the filter for the collection? Are you trying the set the first or second part of the filter?

---

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [November 20, 2024, 4:29am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/10 "2024-11-20T04:29:01Z")

</div>

Yes, a collection. This would be the 3rd part of the filter if i add it.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/e/fe8f75c85cecf6fa60d72ef9b692c749392ad40b.png)

---

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [November 20, 2024, 4:36am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/11 "2024-11-20T04:36:56Z")

</div>

Even when I test with another collection to add 1 filter, I still do not see the option to filter by screen. Are we looking at different types of screens?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/c/0c4b98e74140c949753890fb5d6a883377ae44ba.png)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [November 20, 2024, 4:40am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/12 "2024-11-20T04:40:48Z")

</div>

I can’t tell by your previous screenshots, but in your latest screenshot, you aren’t looking in the right spot. You filter BY the screen value, so it would be the second part of the filter. For example, X is Screen\>Y. In your screenshots your filters are looking for checked or not checked, so you don’t even have the second part of the filter opened up.

---

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [November 20, 2024, 4:53am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/13 "2024-11-20T04:53:06Z")

</div>

Ok, I found it! Thanks. Brain lapse ☺

---

<div class="post-metadata">

**Author:** ![Sekayi\_Liburd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sekayi_liburd/32/77608_2.png) [@Sekayi\_Liburd](https://community.glideapps.com/u/Sekayi_Liburd)\
**Post date:** [November 20, 2024, 5:01am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/14 "2024-11-20T05:01:06Z")

</div>

I can delete the query column 🍻

---

<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:** [November 27, 2024, 5:01am UTC](https://community.glideapps.com/t/query-with-random-sort/78032/15 "2024-11-27T05:01:41Z")

</div>

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