Sort by timestamp not working correctly

My app’s URL: https://aperturomc-demo.glideapp.io.

My app creates a list of posts created by users. Each post is time-stamped, and they are sorted Z->A by timestamp. Old posts sort correctly, but when a user adds new posts, they are put at the bottom of the list, although they are then sorted correctly among themselves.

“Reverse list” works correctly, so I will use that going forward. For now, I am keeping the timestamp sort until you can look into it.

1 Like

Very interesting app. But by looking at the app I can’t see or understand what your issue is. When you say “they are sorted Z->A by timestamp” Where is this sort taking place? Is it a formula in the spreadsheet?

Your app look great.
How did you include the bullets and bold? Did you do in the sheet or used HTML formatting?
Also, how did you include table in the score tab?
Very interesting built :ok_hand:

Here are a couple threads that might help explain what’s happening. You are attempting to sort a timestamp, but that’s not how glide sees. Even though it’s mostly numbers, it’s till just text to glide. Sorts happen left to right, so no matter what, 1 comes before 2. Doesn’t matter if it’s a month, day, or year. It’s just sorting by individual character by character. The reverse order may be working for now, but remember that we just went from September (9) to October (10). Glide is comparing the 1 and the 9 first.

2 Likes

Same methods that are described in your other thread. Markdown and the Rich Text component.

The way to solve it will be to add a new column in you sheet the will present the timestamp as number (every date is actually a number in Google sheets) and to have the blogs sort by this column as z-a.
Hope this works :blush:

2 Likes
  1. The only solution I know of is to create a helper column in Sheets that is sorted the way you want and in Glide sort by the helper column. I have currency columns (P2) that I had to create a help column formatt like this - =text(P2,“000000”). You may need to use a little different formatting for a date field, but you get the idea.

  2. off-topic: in your App how did you display the Leader Board under “Score Card”? Is that a Sheet Chart?

I created cells in the spreadsheet that generate Markdown-compatible text. I followed the examples posted else where in the forum, plus a lot of trial-and-error. Below are some samples from my app’s Scorecard (the length of the table is dynamic and tied to the number of users of the app).

Table heading

=ArrayFormula(" |  " & R1 & "  | " & S1 & " |  " & T1 & "  |  " & U1 & "  |" & CHAR(10) & "| :---: | :--- | :---: | :---: |") & CHAR(10)

Table rows

=arrayformula(if($L$2:$L<>""," | " & R2:R & " | " & if(LEN(S2:S)<=14, S2:S, LEFT(S2:S, 14) & "…") & " | " & fixed(T2:T*100,0)&"%" & if($Q$2:$Q=1,"*","") & " | " & fixed(U2:U*100,0)&"%" & if($K$2:$K=1,"*","")& " | " & CHAR(10),""))

Heading + rows + bottom note

=V1 & concatenate(V2:V) & "|&nbsp;|&nbsp;|&nbsp;|&nbsp;|" & CHAR(10) & "| | *Activity count goal* |" &"*"&Team!$AE$1&"*"& "|" &"*"&Team!$AE$1*Team!$W$1&"*"& "|"

This explains it. The built-in “reverse order” is suitable for what I need. Thanks for your help!