Sorting with current date highest up

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.


This is the same menu scrolled down from the top, screenshot was taken 24th of May

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

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)

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.

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.

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

1 Like

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.

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.

2 Likes

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


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.

1 Like

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

Best, Mikael

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

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?

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

1 Like

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.

3 Likes

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! :grinning: Thanks a lot, Darren

3 Likes

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