Hi @Bas_de_Bruijn ,
while not super-trivial, I wanted to give it a try to show the great power of Coda capabilities.
It can be done with a single action (I already put the code in the button) thanks to the features that WithName() now enables, and this is the formula:
[Recurring tasks].Filter(
[Include when copying tasks?]
&& ([Every week?]="Weekly"
|| [Every week?]="Even weeks" && [Week select].IsEven()
|| [Every week?]="Odd weeks" && [Week select].IsOdd()))
.FormulaMap(CurrentValue.WithName(rec,
If([Scheduled tasks].Filter(
[Week #]=[Week select]
&& Customer=rec.Customer
&& [Task description]=rec.[Task description]).Count()>0,_Noop(),
rec.Days.FormulaMap(CurrentValue.WithName(day,
[Scheduled tasks].AddRow(
[Scheduled tasks].Customer, rec.Customer,
[Scheduled tasks].[Task description], rec.[Task description],
[Scheduled tasks].Hours, rec.Hours,
[Scheduled tasks].Start, rec.Start,
[Scheduled tasks].End, rec.End,
[Scheduled tasks].Employee, rec.Employee,
[Scheduled tasks].Date,
DateTimeTruncate((Date(Today().Year(), 1, 1) + ([Week select] ) * 7), 'week')+day)
)))))
As you can see, I just added an additional column (Days) for convenience in the Recurring Tasks table and that’s all.
Let me know if you need further explanations.
Cheers!