Calculating sum of hours via microflow and showing it in a data snippet.

0
Hi all, Currently I am working on an hour registration app and I encountered a problem.  An employee(TeamMember) is assigned to different projects and project consists of multiple employees (see figure below). An employee can enter their (project specific) working hours in a table where it will be saved in  ‘Day’.  (see 2nd figure) Want I want is data snippet which calculates the amount of hours worked on monday, tuesday etc. So in my example this user has worked on two projects (‘Hallo’, and ‘Dopje’) and in total he has worked 8 hours each day.   My thoughts/progress: For now I created a non persistable entity in the domain with an atribute e.g.(TotalHoursMonday) which I can use for the data snippet. Furthermore upon filling in the hours a microflow is called which commit the data. This flow I can use to start another microflow if I want. So my question is now how to proceed. When I tried this on my own I had difficulties with finding/retrieving the right data which is bound to this user. I am open for suggestiongs or other ways to display this. kind regards, Jordy Forget about the unassigned hours (not part of my question) structure of table:
asked
1 answers
1

If I understand you correctly you would want to have a snippet with a total line at the bottom of the page, such as:

 

Total:  8    8    8    8     8    0    0    0

I also understand that you're creating a non persistent entity (NPE) with attributes for the seven daily totals. Maybe you should add an entity week.

Associate the entity week to projecthours and to your totals NPE. 

 

the snippet can then be filled by a datasource microflow that would have the week as input parameter and the user if you cannot use current user.

Now you can count the HourRegistrations for the week of this user….

If you make the NPE persistable, you can update the totals everytime hours are booked to a date….

Go make it!

Jacob

answered