Creating a chart with hourly entries

0
Hi all, I have a chart that I want to show waste entries per hour for that day. So if I log some waste at 11am and have logged waste before at let’s say 8, 9 and 10am, i would like to see a bar chart with a bar for each hour. I have set the time for each logged entry to be at the start of that hour, so if I log one at 12:15 it will be registered as 12:00. Is there a way in a microflow to create a list that will only retrieve the values for that day and aggregate them by hour? I seem to be unable to get it to work when trying to work with/create lists. Any help will be greatly appreciated. Thanks, Marc
asked
1 answers
3

You have to take a look at the documentation here: https://docs.mendix.com/refguide/add-date-function-calls#addhours

In a microflow create a date at the start of the day. Use the addHours function to create a second date one hour later. Then do a retrieve on the database where the date of the stored objects is between those two dates. Use the list function to count the list and you have the number of events in that hour. You can then again use the addHour function to add 1 hour to both dates and do everything again. Loop this and stop when a new day begins.
Hope this helps,
Ronald

 

answered