Hi @niels.deboer,
Thanks for raising this question, and welcome to the community!
Why there are no loops in loops
First, some background to this, as this is indeed a design decision. The “problem” with loops in loops is that the number of actions performed can quickly get way out of hand. This can potentially lead to performance problems, infinite loops and much higher than expected costs as a result of that.
That being said, there are several ways to work with situations where you could also use loops in loops. Here are, for several situations, solutions.
Solution 1 - multiple steps
In many cases you can subdivide the process into multiple steps. For example, if you have multiple companies, and those each have employees for which you want to perform a specific process you can do the following:
- Select the companies you need with a lookup
- Select the employees you need, from the companies you looked up, in a second lookup
- Use this last list to perform a repeat action
In your case, what I would probably do is store/link the list of dates in the employee data item. For example, something like ‘Temp registered days’. This would be your first repeat action.
Then, with that data stored, you can create a 2nd repeat action over the employees (the list) / Temp registered days’. This will get you an iteration for each ‘Temp registered day’ which is linked to an employee.
The advantage of this solution is that is completely synchronous; meaning all the data is generated before the flow part ends.
Solution 2 - data triggres
The most commonly used solution is to leverage the use of data triggres in automation flows. In general:
- Loop through first data item (e.g. selected Employees)
- Store list of 2nd items to loop through in each item (e.g. store list of dates in each Employee)
- Automation flow with data triggre on this property, triggered for each changed data item (limited to this specific property)
- Inside the automation flow, you have a repeat action to loop through the list
In your case, this means for each employee that is selected, you’d store a list of dates (i.e. as a Date list property).
Then you have an automation flow that starts whenever that list of dates property is changed. In that automation flow you would create the hour registration for each date.
Note that you cannot change the list property inside the automation flow, since that would trigger the automation flow again (this is another protection against infinite loops).
I hope that either of these solutions works for you!