# Repeat action inside a repeat action

**URL:** <https://community.triggre.com/t/repeat-action-inside-a-repeat-action/545>\
**Category:** Support\
**Tags:** actions, designer, repeat, flow-parts\
**Created:** [October 25, 2023, 10:33am UTC](https://community.triggre.com/t/repeat-action-inside-a-repeat-action/545 "2023-10-25T10:33:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rick](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rick](https://community.triggre.com/u/rick)\
**Post date:** [October 25, 2023, 10:33am UTC](https://community.triggre.com/t/repeat-action-inside-a-repeat-action/545/1 "2023-10-25T10:33:06Z")

</div>

Hi there,

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_.

Would you do it in a different way?

---

<div class="post-metadata">

**Author:** ![Jochem](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.triggre.com/jochem/32/91_2.png) [@Jochem](https://community.triggre.com/u/Jochem)\
**Post date:** [October 26, 2023, 11:22am UTC](https://community.triggre.com/t/repeat-action-inside-a-repeat-action/545/2 "2023-10-26T11:22:20Z")

</div>

Hi Rick,

So, in other words, you want to find the number of hours for an employee for a certain day?

Why then not use the flowpart where you check active employees for the suggested date?

Or do I miss a variable?

Jochem

---

<div class="post-metadata">

**Author:** ![Eddie](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.triggre.com/eddie/32/89_2.png) [@Eddie](https://community.triggre.com/u/Eddie)\
**Post date:** [October 26, 2023, 11:42am UTC](https://community.triggre.com/t/repeat-action-inside-a-repeat-action/545/3 "2023-10-26T11:42:38Z")

</div>

Hi Rick,

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:

1. Create a temp data-item with the following properties:

- Employee
- Date

1. Do a look-up on all work hours within a specific month (work hour date \< today and work hour date \>= today-1month)
2. Create a repeat action for every work hour of every employee
3. 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.
4. Now you have a (temporary) list with all employees and all dates.
5. Then you can create another repeat action based on the employees of item 2.
6. Create a lookup that selects all dates stored in the temporary item for that specific Employee.
7. Create an action within the repeat action with the function “Count items in List A”.
8. The result of step 8 are all unique dates that specific Employee has worked.
9. Then at the end of the flowpart, lookup all items in the temporary data-item
10. Delete all items of item 10, so the temp file is emptied again, to use a next time.

Let me know if this is what you expected.

---

<div class="post-metadata">

**Author:** ![rick](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rick](https://community.triggre.com/u/rick)\
**Post date:** [November 2, 2023, 12:36pm UTC](https://community.triggre.com/t/repeat-action-inside-a-repeat-action/545/4 "2023-11-02T12:36:07Z")

</div>

Hi Jochem,

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.

Alejandro.

---

<div class="post-metadata">

**Author:** ![rick](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rick](https://community.triggre.com/u/rick)\
**Post date:** [November 2, 2023, 12:37pm UTC](https://community.triggre.com/t/repeat-action-inside-a-repeat-action/545/5 "2023-11-02T12:37:31Z")

</div>

Hi Eddie,

Thanks for your reply. Yes, this is exactly what I wanted to know. Now I know more ways to solve this in the future.

Alejandro.

---

<div class="post-metadata">

**Author:** ![Eddie](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.triggre.com/eddie/32/89_2.png) [@Eddie](https://community.triggre.com/u/Eddie)\
**Post date:** [November 2, 2023, 12:57pm UTC](https://community.triggre.com/t/repeat-action-inside-a-repeat-action/545/6 "2023-11-02T12:57:17Z")

</div>


