How to organize scripted fields in order

Hi, currently I created a scripted field containing the days of week and explaining how much logs have come during that day. I am currently trying to organize the days into the week order (e.g. sunday, monday, tuesday, wednesday, thursday, friday, saturday) but currently it is like this :

I want to be able to change the dates to the week order.

This is my script currently inserted :

["", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][doc['xxx'].value.dayOfWeek]

Let me know what works best! I tried alphabetically, descending, ascending, to no luck.

Hi @jamesyone,

I can't think of any "good" way of achieving this unfortunately. There is a hackish way though, you can prefix your strings with invisible character that would work if you choose Alphabetical in Order by:

[' Mon', ' Tue', ' Wed', ' Thu', ' Fri', ' Sat', ' Sun']

Every day name is prefixed with a char from the following table:

Number    Name                   HTML Code    Appearance
------    --------------------   ---------    ----------
U+2000    En Quad                       " " for Mon
U+2001    Em Quad                       " " for Tue
U+2002    En Space                      " " for Wed
U+2003    Em Space                      " " for Thu
U+2004    Three-Per-Em Space            " " for Fri
U+2005    Four-Per-Em Space             " " for Sat
U+2006    Six-Per-Em Space              " " for Sun


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.