Is it necessary that the calculation of the ratio’s is made in a document?
You can probably just paste your code into a reconciliations template and use the copy details button to transfer your manual input data to the next year.
I think you’ll need to change your code to something like this (it’s stripped and not all your code is there, to make it more clear for you):
{% assign previous_period = period.minus_1y %}
{% stripnewlines %}
{% newline %}
{% hideunlessi false %}
Manual input for the calculation of the ratio
{% newline %}
{% newline %}
|--------------------------------------------
|-----15%------------------------------------:
|-----------15%------------------------------:+
{% newline %}
| Average number of employees (FTE)
| {% $0+input period.custom.ratio.VTE_CY as:currency placeholder:’’ %}
| {% if previous_period.exists %}
{% $1+input period.custom.ratio.VTE_PY as:currency default:period.minus_1y.custom.ratio.VTE_CY %}
{% else %}
{% $1+input period.custom.ratio.VTE_PY as:currency placeholder:’’ %}
{% endif %}
{% endhideunlessi %}
{% endstripnewlines %}
Saldo : {{ $1 | currency }}
So, your custom objects need to change to period.custom, otherwise you will not be able to get the info from the object from previous period, if it exists.
So, if the previous period exists, we’ll add a default. Which default?
This one :
period.minus_1y.custom.ratio.VTE_CY
Can you go with this @svalais ? So you’ll definitely need to change your objects and attach it to the period-drop.