0

Sort table by month name in numerical month order?

I have a table grouping data by month. When I leave the column as month(my_date) I get months 1...12 and the table is nicely ordered Ascending from 1 to 12 (my choice).

I've now decided to use monthName(month(my_date)) and the table is no longer sorted by month number, but now by alphabetically by name.

How do I get this table to sort Ascending from January to December?

Thanks!

 

8 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    You need to add the month number in front of the month names. You can create a new formula field and put this in the code:

    format(my_date, "MM - MMMM")

    This will put a two digit number in front of the month name. Now you can sort ascending and it will put it in correct order.

     

    You can check out the format() function and the date/time formats for more info.

      • Kent_Signorini
      • 1 yr ago
      • Reported - view

      Fred 

      Oh man. That looks terrible. Ok. 

      • Kent_Signorini
      • 1 yr ago
      • Reported - view

      Fred Sorry; that probably sounded harsh. I appreciate the help. I just wish Ninox had a prettier solution, but I see how this will work. Thanks again. 

      • Kent_Signorini
      • 1 yr ago
      • Reported - view

      Fred Yup. That worked. Thanks a bunch.

      • Ninox developper
      • Jacques_TUR
      • 1 yr ago
      • Reported - view

      Kent Signorini If you are trying to sort a view field, then you can sort the table source. In the field formula you put this code:

      select myTable order by month(this.myDdate)
      • Kent_Signorini
      • 1 yr ago
      • Reported - view

      Jacques TUR Doesn't seem to be working. My table is actually a View on a dashboard. Here is my code (with a modified version of your modifications--I took out the "this." since this is actually the dashboard, right?).

      This is my View's formula:

      let t := this;
      if tableYear != 0 then
          (select Appointments where year('Date & Time *') = t.tableYear) order by month('Date & Time *')
      else
          (select Appointments) order by month('Date & Time *')
      end
      

      tableYear is just a numerical value for the year I want to filter the view on, taken from another source on the dashboard.

      Still, I get months ordered alphabetically.

      What have I done wrong?

       

      • Ninox developper
      • Jacques_TUR
      • 1 yr ago
      • Reported - view

      Kent Signorini I had not seen that the table was grouped by month. Indeed, grouping or sorting the table manually cancels the sorting that is done with the select function.
      Sorry, the best way is what Fred  suggest.

      • Kent_Signorini
      • 1 yr ago
      • Reported - view

      Jacques TUR OK thanks.

Content aside

  • 1 yr agoLast active
  • 8Replies
  • 294Views
  • 3 Following