Is there are any solutions to avoid writing nested loop

Hello all I have two entities Entity1 has only year(int->2,3,4) and Amount(based on year) 2->200 euros, 3->300 euros and so on. I keep this detail in master table because every year amount may change. And in second entity Employee has all employee detail along with its joining date. If employee complete 2 year he will get 200 euros as bonus and so on. In both entities I have a one to one associations. So in microflow I use two nested loop one is iterate over employee where it check the how many years employee completed and then second loop it iterate over Entity1 where it will check employee completion year = Entity1/year and then amount should added to employee. Also its working fine and giving me expected result. But as mendix best practices we should avoid using nested loop. Does anyone know other solution of it?   Thanks   Thanks
1 answers

I would only iterate over the table and then you could use a XPath to retrieve all the employees belonging to that year. Assumption is that you have a start date for each employee. Because then you could based on the date that you are doing this check calculate the start en endate of that year and then do a retrieve that the start date of an employee should be between those dates. This way you only have one iteration and it will be a lot faster I think then iterating over the employees.