To be completed by the original poster:
CMS Version
3.0.5
Player Type
Windows 10 client / Windows 2019 Host Server (manual install)
Player Version
3.0.5
Issue
I have a simple dataset with a column called DayofWeek which allows selection of Monday through Friday (as we have events which recur, recording the day rather than a date makes it more usable).
I can pull the data from the dataset, but i would like to sort the displayed data by “day of week” beginning with whatever the day is today.
I feel like I should be able to do this using DAYNAME(CURDATE()) and DAYNAME(CURDATE()+1) etc, but i can’t seem to get it to work. This would sort by whatever today’s dayname is and then add one for each subsequent +1.
e.g:
ORDER BY FIELD(DayofWeek, DAYNAME(CURDATE()), DAYNAME(CURDATE() +1), DAYNAME(CURDATE() + 2), DAYNAME(CURDATE() +3), DAYNAME(CURDATE()+4), DAYNAME(CURDATE()+5), DAYNAME(CURDATE()+6))
Frankly, i can’t even get a manual list of strings to work as nothing appears in my data, so i might have the syntax completely wrong
I would have expected this to force a display order of M through F (although my plan above was to adjust the start day to today).
ORDER BY FIELD(DayofWeek, 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday')
Any thoughts or guidance?
FYI my filter (which works fine looks like this):
WHERE DayofWeek = DAYNAME(CURDATE()) OR DayofWeek = DAYNAME(CURDATE() + 1) OR DayofWeek = DAYNAME(CURDATE() + 2) OR DayofWeek = DAYNAME(CURDATE() + 3) OR DayofWeek = DAYNAME(CURDATE() + 4) OR DAYNAME(CURDATE() + 5) OR DayofWeek = DAYNAME(CURDATE() + 6)