Rollforward

The rollforward tag is used to copy data from one period to another.

Rollforward is used to copy data from a chosen period to a database variable in the current period. This is done by pressing the copy data option under the action button in the Silverfin platform.

{% rollforward custom.depreciation.passed+custom.depreciation.current custom.depreciation.passed %}

{% rollforward nil custom.depreciation.current %}

When copying data from 2017 to 2018, the code above will add the depreciations of 2017 with the depreciations of the past and put them in the depreciations of the past field of 2018. Meanwhile, the depreciation value of 2018 is set to nil. This way, the current value of 2017 is not taken over.

Rollforward.period

It is possible to use rollforward.period to check to which period the data is being copied. This can be useful if you only want to rollforward in specific cases.

In the example below you only want the current year value to appear in the previous year custom if the period you are rollforwarding data into is actually in a later year.

{% assign rollforward_to_year = rollforward.period.year_end_date | date:"%Y" %}
{% assign rollforward_from_year = period.year_end_date | date:"%Y" %}

{% if rollforward_to_year > rollforward_from_year %}
  {% rollforward custom.depreciation.current_year custom.depreciation.previous_year %}
  {% rollforward nil custom.depreciation.current_year %}
{% endif %}

πŸ“˜

Which period is being rendered?

When copying data, the liquid code for that template is executed again, including any rollforward tags.
The template will be rendered in the period that you are copying data from.
So if you are in 2023 and want to copy data from 2022 into your template using the example code above, the if-statement will be executed.
rollforward_to_year = 2023
rollforward_from_year = 2022

Files

If you want to use rollforward tags for inputs that contain files, you need to add the as:file attribute to the rollforward tag.

This goes for when you want to copy files to a different custom variable (input), but also for when you want to empty the current custom variable.
Let's say we have two inputs for files. In this scenario you want the files to be removed when using the copy data functionality.

{% input custom.invoice.pdf_1 as:file %}
{% input custom.invoices.last_year as:file %}

{% rollforward nil custom.invoice.pdf_1 as:file %}
{% rollforward nil custom.invoices.last_year as:file %}

In the second scenario, you want to add the file of the first input to the second and remove it from the original input.

{% input custom.invoice.pdf_1 as:file %}
{% input custom.invoices.last_year as:file %}

{% rollforward custom.invoice.pdf_1 custom.invoices.last_year as:file %}
{% rollforward nil custom.invoice.pdf_1 as:file %}

And lastly, in this scenario you don't just want to add the file to the existing input, but replace its content. Note that you need to empty it first, and then add the content of the original input.

{% input custom.invoice.pdf_1 as:file %}
{% input custom.invoices.last_year as:file %}

{% rollforward nil custom.invoices.last_year as:file %}
{% rollforward custom.invoice.pdf_1 custom.invoices.last_year as:file %}
{% rollforward nil custom.invoice.pdf_1 as:file %}