Empty fori rolls forward

Hi, We have a quite large fori loop with two tables. Within these tables we want to make a rollforward of a few of the values.
As with fori loops, after completing the tables in the first loop, there is automatically new loop with empty tables.
For example I have completed 2 loops with information, and have an empty loop in year 1.
Our problem is that when we go to year 2 and copy the data we get the two completed loops from previous year as well as the empty tables from year 1, as well as new empty tables. So in year 2, we have two empty tables.
Is there anyway to only copy and roll forward the 2 loops with the information, and not the empty one?

Kind regards,
Anna

Hi @ahaegglund,

You’ll have to make sure nil-values are rollforwarded in that loop (to make sure there’s nothing left in that loop); if you’ll do that, you’ll get the behaviour you want.

More info here:

So doing this for each database input:

{% rollforward nil item.purchase %}