Show list of orders grouped per date, just like Outlook

I want to have a list view that shows all orders grouped per date, just like outlook does with email. Thus it shows 'Thursday 27 december, email 1, email 2; Monday 24 december, email 1-2-3, etc.  It will show the date just once, even when there are multiple orders for that date. If the date is empty, it should be hidden. There are multiple ways to approach this, but I'm unsure which is the best, both in ensuring data consistency and performance. One would be having a datasource microflow that creates non persistent date objects and associated all orders. That would, I think, be bad for performance. Another option would be creating 365 date objects each year and upon creating/updating an order, assigning it to the correct date object. Pretty lightweight, as it would be a simple retrieve. My problem with this, however, is that if the association isn't (correctly) set due to whatever reason, the order won't be shown. What's the best bet?
2 answers

I would do the 365 date objects and create an admin overview for all the orders that do not have a reference to a date object. You could even create some scheduled event that checks for orders without a date reference so somebody can actively do something about those orders. Do make sure that you create a couple of years ahead and do a yearly check to create the object for the new years.

The advantage of having those date objects is that you can also use that for all kinds of dashboard overviews (on which day of the week do I have the highest avarage orders etc). 





An alternative could be to indeed create a calendar entity with a record for everyday, but without setting associations.

Then you could create a listview on the calendar entity and in that listview

 a listview  with a datasource microflow  that filters out the relevant orders...

[day-from-dateTime(OrderDate) = day-from-dateTime($calendar/Datum)]
[month-from-dateTime(OrderDate) = month-from-dateTime($calendar/Datum)]
[year-from-dateTime(OrderDate) = year-from-dateTime($calendar/Datum)]

A bit performance intense i am afraid.


Another option is your calendar model with associations to the orders and to check for orders not associated with a date and fixing that.