Solved

Can we sort a WebUI table by date (for some reason it only sorts dates as if they were strings)?

  • 29 January 2020
  • 3 replies
  • 158 views

Badge

The column, by which we want to sort, contains an element parameter whose range is a calendar. If I sort the table by the column, it sorts as if its elements were strings, not dates.

icon

Best answer by Gertjan 26 May 2020, 08:39

View original

3 replies

Userlevel 3
Badge +6

Dear Zoltan,

 

You are right, in the current implementation of the Table sorting in the WebUI, there is no special treatment of ‘date’ columns, so they are indeed sorted alphabetically. I discussed this with the developer of the sorting, and he indicates that it should be possible to implement the exception. I will file an internal request for this.

 

He also provided a kind of workaround for this, but I cannot judge from the information in your post whether this will be good enough in your situation. The idea is to create a subset containing the whole master set and sort this subset based on the element parameter in your column. After that, slice the identifier(s) in the column(s) to this subset.

 

Probably this is a bit unclear from my explanation, so I have included a sample model to show this. The SortedSeasons set is the sorted subset of the master set Seasons, and in the WebUI table, both identifiers are sliced to the ss index of the subset. When sorting the SeasonName column, this behaves as expected (i.e.; alphabetically) and when NOT sorting (i.e. keep on default) the StartingDay column, it will be sorted based on the subset order, which is based on the calendar order.

 

Regards,

Mischa

Userlevel 6
Badge +6

We have adapted the code and in a next release of AIMMS (likely 4.74) will use the actual dates of the calendar elements when sorting (btw, if any custom order is added to eg a subset of a Calendar - which seems illogical - it will be ignored).

 

@zoltanlelkesjr 

@mateusarakawa 

Userlevel 6
Badge +6

Good news @zoltanlelkesjr, @mateusarakawa: Today we released 4.74 with this adjustment; for details, see https://www.aimms.com/english/developers/downloads/product-information/new-features/

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator