# CASE rollforward: copy amounts into other objects from one year to the next year

**URL:** <https://community.silverfin.com/t/case-rollforward-copy-amounts-into-other-objects-from-one-year-to-the-next-year/1158>\
**Category:** Cases\
**Tags:** rollforward, use\_case\
**Created:** [August 28, 2018, 9:03am UTC](https://community.silverfin.com/t/case-rollforward-copy-amounts-into-other-objects-from-one-year-to-the-next-year/1158 "2018-08-28T09:03:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [August 28, 2018, 9:03am UTC](https://community.silverfin.com/t/case-rollforward-copy-amounts-into-other-objects-from-one-year-to-the-next-year/1158/1 "2018-08-28T09:03:53Z")

</div>

Let’s say we manually put in some movements regarding financial investments in year 2016:

 ![40](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/776a15a2945d55326bc8e6d42b7436ebd67088a3.png)

It would be great then, when copying these details from 2016 to 2017, the amounts in column End value would be transferred to the column Begin value (so I don’t need to manually overwrite those amounts, because copying details is just a copy of one period).

💡  
With the rollforward-tag you can however! This allows to mark a certain input-object or variable to be transferred to another object or variable the next year.

Take the code of our template:

```auto
{% stripnewlines %}
| Description
| Begin value
| Purchased
| Sold
| End value
{% newline %}
|----20%----
|----20%----:
|----20%----:
|----20%----:
|-----------:+
{% fori item in custom.financial_investments %}
  {% newline %}
  | {% input item.description placeholder:"" %}
  | {% $1+input item.begin_value as:currency %}
  | {% $2+input item.purchase as:currency %}
  | {% $3+input item.sold as:n_currency %}
  | {% =$4+ $1+$2+$3 | currency %}
    {% assign $1 = 0 %}{% assign $2 = 0 %}{% assign $3 = 0 %}
  {% if forloop.last %}
    {% newline %}
    |
    | 
    |
    |
    |^_ **{{ $4 | currency }}** _^|
  {% endif %}
{% endfori %}
{% endstripnewlines %} 

```

We want the value of `$1+$2+$3` to be copied into `item.begin_value` the next year.

By adding the rollforward-tag you can, like this:

```auto
{% rollforward $1+$2+$3 item.begin_value %} 

```

If you want other fields to have 0.00 you could have this rollforward as well:

```auto
{% rollforward 0 item.purchase %} 

```

or use nothing to fill up that field:

```auto
{% rollforward nil item.purchase %} 

```

Here’s the complete case:

```auto
{% stripnewlines %}
| Description
| Begin value
| Purchased
| Sold
| End value
{% newline %}
|----20%----
|----20%----:
|----20%----:
|----20%----:
|-----------:+
{% fori item in custom.financial_investments %}
  {% newline %}
  | {% input item.description placeholder:"" %}
  | {% $1+input item.begin_value as:currency %}
  | {% $2+input item.purchase as:currency %}
    {% comment %}reset value on zero when copying details{% endcomment %}
    {% rollforward nil item.purchase %}
  | {% $3+input item.sold as:n_currency %}
    {% comment %}reset value on zero when copying details{% endcomment %}
    {% rollforward nil item.sold %}  
  | {% =$4+ $1+$2+$3 | currency %}
    {% comment %}the end value needs to be transferred to the next year as begin value{% endcomment %}
    {% rollforward $1+$2+$3 item.begin_value %}
    {% assign $1 = 0 %}{% assign $2 = 0 %}{% assign $3 = 0 %}
  {% if forloop.last %}
    {% newline %}
    |
    | 
    |
    |
    |^_ **{{ $4 | currency }}** _^|
  {% endif %}
{% endfori %}
{% endstripnewlines %}

```
