# Sorting with current date highest up

**URL:** <https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072>\
**Category:** Ask for Help\
**Created:** [May 24, 2023, 7:10am UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072 "2023-05-24T07:10:30Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikael\_Nystrom](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikael_nystrom/32/58524_2.png) [@Mikael\_Nystrom](https://community.glideapps.com/u/Mikael_Nystrom)\
**Post date:** [May 24, 2023, 7:10am UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/1 "2023-05-24T07:10:30Z")

</div>

Hey there, I’m working with a table that contains dates and a weekly menu for restaurants. What I’m trying to do is to have the current day’s date appear at the top of the app whenever it’s opened. At the moment, I’ve got the table grouped by date and sorted in ascending order (A → Z). Is there a trick to always have today’s date show up at the top? I’ve attached some pictures for better context.

 ![date_showcase](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/1/f1339afc609b8195bed6479fa778ae8d90376d5f.jpeg)

---

<div class="post-metadata">

**Author:** ![Mikael\_Nystrom](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikael_nystrom/32/58524_2.png) [@Mikael\_Nystrom](https://community.glideapps.com/u/Mikael_Nystrom)\
**Post date:** [May 24, 2023, 7:11am UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/2 "2023-05-24T07:11:33Z")

</div>

![date_showcase2](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/0/70efbc9229f085fb6ed9d0bd1a74c13058fcd0af.jpeg)  
This is the same menu scrolled down from the top, screenshot was taken 24th of May

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 24, 2023, 7:24am UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/3 "2023-05-24T07:24:53Z")

</div>

I think if you sort by Date descending, you should get what you need.

---

<div class="post-metadata">

**Author:** ![Mikael\_Nystrom](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikael_nystrom/32/58524_2.png) [@Mikael\_Nystrom](https://community.glideapps.com/u/Mikael_Nystrom)\
**Post date:** [May 24, 2023, 4:27pm UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/4 "2023-05-24T16:27:25Z")

</div>

Hi Darren and thanks a lot for your response. It almost works if I sort by Descending however, Today’s date is not at the top but the last date in the sheet (Friday 26th of may)

 ![week_showcase3](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/2/62ffaef82af45d146f2802922986bd2e53eae431.jpeg)

---

<div class="post-metadata">

**Author:** ![fabio](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/fabio/32/16336_2.png) [@fabio](https://community.glideapps.com/u/fabio)\
**Post date:** [May 24, 2023, 4:33pm UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/5 "2023-05-24T16:33:40Z")

</div>

Hi Mikael,  
2 question:  
Is this app based on Google sheets?  
People are supposed to edit the items in the app or it is a “read only” app?  
If it’s based on google sheet and the app is “read only” I think you might get it in google sheet.

---

<div class="post-metadata">

**Author:** ![Mikael\_Nystrom](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikael_nystrom/32/58524_2.png) [@Mikael\_Nystrom](https://community.glideapps.com/u/Mikael_Nystrom)\
**Post date:** [May 24, 2023, 4:47pm UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/6 "2023-05-24T16:47:28Z")

</div>

Hi Fabio!

Thank you for your response, It’s a read-only application where users can see restaurant menus for the current week. It’s based on glide’s tables currently but if what i’m after can be easily made in Gsheets then I can definitely switch.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 24, 2023, 4:51pm UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/7 "2023-05-24T16:51:26Z")

</div>

Sounds like you’re sorting by sheet order?  
Try sorting by Date.

---

<div class="post-metadata">

**Author:** ![Mikael\_Nystrom](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikael_nystrom/32/58524_2.png) [@Mikael\_Nystrom](https://community.glideapps.com/u/Mikael_Nystrom)\
**Post date:** [May 24, 2023, 5:00pm UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/8 "2023-05-24T17:00:14Z")

</div>

Sorted by Date originally, not Sheet Order. I have managed now to make something that seems to work, sorting by the date\_diff column in ascending order makes it so that today’s date shows up at the top.

 ![week_showcase4](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/4/f4973c435e866122d67cac510246fbfa11926552.jpeg)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 24, 2023, 5:09pm UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/9 "2023-05-24T17:09:38Z")

</div>

Sorting by Date in descending order should give you exactly the same result.

What you’ve done there might appear to be working, but you will find that it will break down once you start getting older records in your table.

---

<div class="post-metadata">

**Author:** ![Mikael\_Nystrom](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikael_nystrom/32/58524_2.png) [@Mikael\_Nystrom](https://community.glideapps.com/u/Mikael_Nystrom)\
**Post date:** [May 24, 2023, 5:24pm UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/10 "2023-05-24T17:24:41Z")

</div>

I would think so too, but it doesn’t give me the same result. I update the menus on a weekly basis, remove the last week to a collected database and only keep current week up on the app so breaking down when I get older records might not be applicable. i’ll attach photos where you can see the difference in results when sorting by Date and date\_diff column respectively

 ![week_showcase5](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/3/0310385d0e966858038dfe6b9ca72374c4f00d85.jpeg)  
 ![week_showcase6](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/1/b16a7d824dd43b63558f6f130a5bf04a2ffce96d.jpeg)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 24, 2023, 5:30pm UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/11 "2023-05-24T17:30:41Z")

</div>

Oh, wait.

Okay, I apologise - I missed that you have records with future dates. That makes sense now.

In that case yes, what you have there should be okay if you’ll only ever have a single weeks worth of data.

---

<div class="post-metadata">

**Author:** ![Mikael\_Nystrom](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikael_nystrom/32/58524_2.png) [@Mikael\_Nystrom](https://community.glideapps.com/u/Mikael_Nystrom)\
**Post date:** [May 24, 2023, 7:42pm UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/12 "2023-05-24T19:42:49Z")

</div>

Thank you for all the help Darren! I really appreciate it.

Best, Mikael

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [May 24, 2023, 7:52pm UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/13 "2023-05-24T19:52:50Z")

</div>

You can convert a date to a number and sort by it. But I don’t get why sorting by date is not working. I don’t have an issue with that… even if the date is in the future… to eliminate days that are greater than today’s date… use filter

---

<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:** [May 25, 2023, 12:19am UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/14 "2023-05-25T00:19:30Z")

</div>

So after the “today” list what should be the order, if you have multiple records into the future?

Say you have records for 20 May to 28 May, and today is 25 May, should it go:

25 May  
28 May  
27 May  
26 May  
24 May  
23 May  
22 May  
21 May  
20 May?

---

<div class="post-metadata">

**Author:** ![Mikael\_Nystrom](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikael_nystrom/32/58524_2.png) [@Mikael\_Nystrom](https://community.glideapps.com/u/Mikael_Nystrom)\
**Post date:** [May 25, 2023, 6:05am UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/15 "2023-05-25T06:05:11Z")

</div>

What order it is after today’s date is secondary, what i’m thinking makes most sense is to have it being descending or ascending Date order except for the first one, similar to your comment

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [May 25, 2023, 6:25am UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/16 "2023-05-25T06:25:08Z")

</div>

What you could do is use two collections, and set opposite filter conditions on each one.

For the first one, filter where Date is within Today.  
And for the second one, filter where Date is not within Today.

You wouldn’t need to sort the first one, and the second one could be sorted in descending Date order.

---

<div class="post-metadata">

**Author:** ![Mikael\_Nystrom](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikael_nystrom/32/58524_2.png) [@Mikael\_Nystrom](https://community.glideapps.com/u/Mikael_Nystrom)\
**Post date:** [May 25, 2023, 6:37am UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/17 "2023-05-25T06:37:30Z")

</div>

That’s very smart, and does not feel like a short term “decent” solution, it sounds spot on to what i’m trying to do. Such an easy solution too! 😀 Thanks a lot, Darren

---

<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:** [May 26, 2023, 6:38am UTC](https://community.glideapps.com/t/sorting-with-current-date-highest-up/62072/18 "2023-05-26T06:38:10Z")

</div>

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