Adding multiple rows with condition and foreach

Hi,

I’ve a table calles modules, all my modules for university are stored there. They had a start-date, a assignment-date and a number of days, I’ll need to prepare for the assignment
And i have a second table with my learning content for the modul, like 500 sides, 25 videos, …

now I try to write a formula, that calculates my workload for each module per week.

  • calculate how many weeks I have: startdate- date of assignment - preparing time / 7 → weeks I have for preparation → weeks

  • after that, I would like to calculate how much pages/videos I have to prepare each week
    200/weeks, 25/weeks

and finally I would add this as a row in a table called events:
week 1: startdate, 200/weeks pages, 25/weeks videos
week 2: startdate+7 200/weeks pages, 25/weeks videos

I hope, I could describe, what I want to do.

I am really new at coda, thats why I#m struggling to put these all together in one formula

At the moment, I am struggling with this point:

withName(
Foreach(
Lernmaterial.Modul,
RoundDown(
toNumber(
([Prüfungsdatum] - Startdatum -
[Prüfungsvorbereitung]),
0
) /
7
)
),
week,
week.ForEach(
Sequence(0, CurrentValue ).ListCombine()
)
)

this formula calculates correctly the weeks and iterates about them, but how can I get the current value of Lernmaterial.Modul to combine them in a new list in the last line?

I think you need to use the formula feature “CurrentValue” which is visible inside the ForEach.