I am now facing a challenge I often face and I always solve it in a certain way, but I wonder how you would do it. I get the feeling I could be doing extra work.
I want to calculate the number of days employees were present in a given month. We have the data item team member and week hours. The data item week hours contains the hours a team member works per week, along with other properties. What I would first do is use a data look-up to find all active employees in team members. Then I would use a repeat action to find week hours of a given month per active employee. And here comes the tricky part, then I want to go through every week hours found to calculate how many days of the week they were present, or in other words to check if there are hours registered on a given day. But Triggre does not allow you to use a repeat action inside another repeat action. What I then do is use a data look-up to find all week hours of active employees. Go through every single week hours to calculate how many days the employee was present and save the value in the current data item team member.
If I read it correct you want to know the following:
How many unique days did a person work in a certain month
I think what you can do is the following:
Create a temp data-item with the following properties:
Employee
Date
Do a look-up on all work hours within a specific month (work hour date < today and work hour date >= today-1month)
Create a repeat action for every work hour of every employee
In that repeat action:
4a. Do a look up on Employee and Date in your temp data-item (created in step 1)
4b. if it’s NOT empty, go to end of repeat action
4c. if it’s empty, than add a new item with the date and employee.
Now you have a (temporary) list with all employees and all dates.
Then you can create another repeat action based on the employees of item 2.
Create a lookup that selects all dates stored in the temporary item for that specific Employee.
Create an action within the repeat action with the function “Count items in List A”.
The result of step 8 are all unique dates that specific Employee has worked.
Then at the end of the flowpart, lookup all items in the temporary data-item
Delete all items of item 10, so the temp file is emptied again, to use a next time.
Thanks for you reply. Yes, I am sorry. I think I oversimplified my problem and did not explain all the details. But Eddie seemed to have understood the idea, because now I know a different way to tackle this problem.