Time not sorting in list view

I’m making a very simple app to highlight local happy hours:

I have a couple questions:

  1. Is there a way to make the list collapsible by day? Otherwise this design will not work as it will grow way too long.
  2. I have the inline list set up to sort by time which is pulling from a time field in the spreadsheet but it doesn’t seem to work as expected.

What do you mean by “collapsable”? Can you describe what the desired user experience would be?

Check the associated column type in the Glide Data Editor. You might find that Glide is interpreting it as a plain text or number column.

1 Like
  1. In other words, where each day of the week was all that was initially seen and one would click on a day to expand all the bars with happy hours under that. Alternatively the app could detect the day and only show the list of bars with happy hours on that day.
  2. It’s definitely set as a date/time field.

This could be related: Collapsible sections & Tabs like in "Glide & Wine" but I don’t know the video she’s talking about so it’s hard to know if she’s going for the same thing.

Okay, so essentially you want to filter the list of bars by the day of the week, yeah?
Either approach that you’ve described here is possible - which would be your preference?

Okay. And the issue is that the times are not sorting as you would expect?
One thing to be aware of here is that even though you have have the Glide column set to display as Time Only, Glide will still store the value internally as a full datetime value. So it could be that not all your time values have the same date. You could check this by reconfiguring the column to display the date as well as the time.

However, in this case - where you only care about the time, and the date is irrelevant - what I would suggest is to save the time as a numeric value representing the hour of the day. That would make it much easier to do comparisons to the current time. For example, let’s say you want a list of bars that will be opening in the next 3 hours, you could do something like:

  • Use a math column with the formula Hour(Now) where “Now” is the special Now (current datetime value). This will give you the current hour of day as a number.
  • Create a 2nd math column that adds 3 to that - Hour(Now) + 3
  • Now use an if-then-else column to compare those two columns to your bar opening time:
    – If Opening time is less than now, then empty
    – If Opening is greater than now+3, then empty
    – Else true

This will result in a boolean value that will be true for those bars that are open now, or in the next 3 hours.

PS. I noticed that your “Make a Suggestion” tab has a link to a Google Form. erm… why? You could very easily collect that data by using a form in the app.

2 Likes

This is all very helpful thanks.

As far as filtering bars by day of the week, my ideal would be that the app would detect the day and automatically expand out all bars who have specials on that day. Below this could be lists (but not fully expanded) for each of the following days of the week.

Example: Today is Wednesday. So when you open the app it gives you:

Wednesday

  • John’s Pub
  • Carl’s Bar
  • Susan’s Dive
  • etc. etc. etc.
    Thursday (click to expand)
    Friday (click to expand)
    etc.

On the “make a suggestion” google form thing I’m still learning all the features and functionality of Glide. It’s gotten pretty robust since I first experimented with it way back. So, in short, I didn’t even think about interval forms being an option, though it seems obvious it would be now.

Since you are storing the happy hour day as text, you have a couple of options. You could instead store it as the numerical equivalent of the day if the week (1-7), or create an IF column that converts the text version to a number.

Once you have that, create a math column with the following formula WEEKDAY(NOW) to get the weekday number equivalent of today.

Then create an IF column to compare the IF column to the math column. If they match then return ‘true’.

You can then filter any rows that contain true, meaning any bars with a happy hour today.