Sorting Groups Ascending or Descending

I am grouping and sorting a table by date, no problems. When looking at the table, we want to know which day it is; no problem there, we can:
concat(date," ",date.weekdayname()) = ‘1/1/2020 Monday’

However with the text now added to the field, we sorting no longer works. Any ideas on how to preserve the group sorting while doing something like this?

Hi @Johg_Ananda,
my suggestion seems so obvious that I have the feeling I’m missing something:

What about keeping both fields (date and transformed date); the first one for sorting the second one for displaying purposes?

In your specific case I’d say play around with the hidden .FormatDateTime() instead.

It will let you show weekday along the date (although weekday will probably go before the date, not after), but unlike Concatenate, this will NOT change value type from Date to Text. So, sorting should still work properly on values as if they were dates, not text.

If you absolutely need weekday in the end, then I suggest making it a separate column and showing to the right of your grouped one. Perhaps group on it as well so that you see it only once per group.

@Federico_Stefanato yes, you’re missing the fact that ordering of groups takes precedence over sorting on any other column. Even if you disable sorting on your date group, their last relative order would still remain “pinned” in the system. I reported this a while ago, but it’s not fixed, and I’m afraid it’s not that trivial to fix either. TL;DR: Coda remembers ordering of groups, and no sorting on ungrouped columns will affect it. It will affect the order of rows within each group, but not of the groups themselves.

Hi @Paul_Danyliuk I had this suspect, especially considering @Johg_Ananda skills: thanks for the explanation

Also a much easier way — instead of .FormatDateTime() just change column format settings via UI to show weekday :slight_smile:

Ah this would have been such a simple and sweet solution, alas! it does not work:

This does work … only if the column is a text format, not a date format, which is a bit counterintuitive. By mirroring the column with the .formatdatetime() and changing to text, the group sort did work:
Screen Shot 2020-07-08 at 1.42.43 PM
:pray: @Paul_Danyliuk

Regarding the “simple and sweet solution” — can you try it once again, but first ungroup and then group again? Sometimes Coda doesn’t regroup after column settings changes.

Text column type works because Text is “any type” kind of column, it just outputs values at face value and doesn’t try to convert them to anything. Date type doesn’t work because date column format settings override your formula output.