Rollforward - make values 0

Hi everyone,

in this template we used a rollforward, to put some values back at 0 - because there the users have to put in new values for the current year.

With the code we use, after we did “copy details” we always get a line with 0 underneath the filled in template.
Can we avoid this extra line with 0 - and how?

´´´

-> Kredieten <-

{% stripnewlines %}
{% fori detail in custom.details %}

{% if forloop.first %}
| {% t “Doel lening” %}
| {% t “Bank” %}
| {% t “Contractnummer” %}
| {% t “Begindatum” %}
| {% t “Einddatum” %}
| {% t “Totaal kapitaalbedrag”%}
| {% t “Reeds afgelost”%}
| {% t “Aflossing huidig jaar”%}
| {% t “Resterend kapitaal”%}
| {% t “Intrest huidig jaar” %}
| {% t “Beroeps%” %}
| {% t “Beroepsmatige intrest” %}
{% ic %}| {% t “Privé intrest” %}{% endic %}
{% ic %}| {% t “Aflossingstabel” %}{% endic %}
{% newline %}
|:----------10%-----------:
|:---------10%------:
|:—10%—:
|:—10%—:
|:—10%—:
|—10%—:
|—10%—:
|—10%—:
|—10%—:
|—10%—:
|----10%----:
|–5%–:
|–10%–:
|----10%–:+#
{% endif %}

{% newline %}

| {% input detail.custom.doel lening %}
| {% input detail.custom.bank %}
| {% input detail.custom.contractnummer %}{% assign contractnummer = detail.custom.contractnummer %}{% result ‘contractnummer’ contractnummer %}
| {% input detail.custom.begindatum | date: “%d/%m/%Y”%}{% assign begindatum = detail.custom.begindatum | date: “%d/%m/%Y” %}
| {% input detail.custom.einddatum | date: “%d/%m/%Y” %}
| {% $3+input detail.custom.totaal_kapitaalbedrag as:currency%}
| {% $4+input detail.custom.reeds_afgelost as:currency%}
| {% $5+input detail.custom.aflossing_huidig_jaar as:currency %}

{% rollforward detail.custom.reeds_afgelost+detail.custom.aflossing_huidig_jaar detail.custom.reeds_afgelost %}
{% rollforward nil detail.custom.aflossing_huidig_jaar %}

| {%=$1+ detail.custom.totaal_kapitaalbedrag-detail.custom.reeds_afgelost-detail.custom.aflossing_huidig_jaar %}
| {% $7+input detail.custom.totale_intrest as:currency %}
{% rollforward nil detail.custom.totale_intrest %}
| {% input detail.custom.beroeps as:percentage %}
| {%=$0+ detail.custom.totale_intrest detail.custom.beroeps %}{% assign beroepsintresten = detail.custom.totale_intrest detail.custom.beroeps %}
| {%=$2+ detail.custom.totale_intrest-beroepsintresten %}
| {% input detail.custom.bijlage as:file %}

{% if forloop.last %}
{% newline %}
|
|
|
|
|
| {{ $3 | abs | currency }}
| {{ $4 | abs | currency }}
| {{ $5 | abs | currency }}
| {{ $1 | abs | currency }}
| {{ $7 | abs | currency }}

|
**| {{ $0 | abs | currency }} {% if ABS(#650000-$0) < 0.01 %}{% unreconciled 0 as:indicator %}{% else %}{% unreconciled #650000-$0 as:indicator %}{% endif %}
| {{ $2 | abs | currency }}
|
{% endif %}
{% if detail.custom.begindatum >= period.year_start_date and detail.custom.begindatum <= period.year_end_date %}
{% $6+ detail.custom.totaal_kapitaalbedrag %}
{% endif %}

{% endfori %}
{% endstripnewlines %}

{% result ‘priveintresten’ $2 %}
{% result ‘totaalkapitaal’ $3 %}
{% result ‘afgelost’ $4 %}
{% result ‘huidige’ $5 %}
{% result ‘nieuwelening’ $6 %}

-> Banksaldo’s <-

{% stripnewlines %}
{% fori bank in custom.bank_saldo %}

{% if forloop.first %}
| {% t “Rekeningnummer” %}
| {% t “Bank” %}
| {% t "Saldo per " %}{{ period.minus_2y.year_end_date | date: “%d/%m/%Y”}}
| {% t "Saldo per " %}{{ period.minus_1y.year_end_date | date: “%d/%m/%Y”}}
| {% t "Saldo per " %}{{ period.year_end_date | date: “%d/%m/%Y”}}
{% newline %}
|:----------20%-----------:
|:---------20%------:
|:—20%—:
|:—20%—:
|:—20%—:#

{% endif %}

{% newline %}
| {% input bank.rekeningnummer %}
| {% input bank.kredietinstelling %}
| {% input bank.saldoy2 placeholder:“Saldo Y-2” as:currency %}{% assign saldoy2 = bank.saldoy2 %}
| {% $8+input bank.saldoy1 placeholder:“Saldo Y-1” as:currency %}{% result ‘beginsaldo’ $8 %}
| {% $9+input bank.saldoy placeholder:“Saldo Y” as:currency %}{% result ‘eindsaldo’ $9 %}
{% rollforward bank.saldoy1 bank.saldoy2 %}
{% rollforward bank.saldoy bank.saldoy1 %}
{% rollforward nil bank.saldoy %}

{% if forloop.last %}
{% newline %}
|
|
|
| {{ $8 }}
|{{ $9 }}
{% endif %}
{% endfori %}
{% endstripnewlines %}´´´

1 Like

Hi Lise

You can wrap these registers in an ifi-statement to prevent these zeros from showing up in export (or just a regular if-statement if you want to hide them in both input & export view).

| {% ifi $3 != 0 %}{{ $3 | abs | currency }}{% endifi %}
| {% ifi $4 != 0 %}{{ $4 | abs | currency }}{% endifi %}
| {% ifi $5 != 0 %}{{ $5 | abs | currency }}{% endifi %}
| {% ifi $1 != 0 %}{{ $1 | abs | currency }}{% endifi %}
| {% ifi $7 != 0 %}{{ $7 | abs | currency }}{% endifi %}

Kind regards
Wouter

Hi Wouter,

this works for all $ except for 4. This is the only where I use a rollforward with a sum.
Any idea if I need to adapt anything more for this one?

Thanks for the help!

The total zero should be hidden with this code, or do you mean that the rollforward is still placing a zero inside the inputs for ‘Reeds afgelost’, even though it’s blank in the previous year?

Hi Wouter,

This is what I get when I make a rollforward:

You see in the 7th column - he adds an extra line with the value 0.

Ah ok, this is caused by having more than one blank row in the period from which you’re rollforwarding, a sum will always return 0 even if the values you’re calculating with are blank.

But we should be able to avoid this zero & extra row being placed here automatically by doing some logic to determine if we should place a value or nil in the rollforward:

{% if detail.custom.reeds_afgelost != blank or detail.custom.aflossing_huidig_jaar != blank  %}
  {% assign reeds_afgelost = detail.custom.reeds_afgelost+detail.custom.aflossing_huidig_jaar %}
{% else %}
  {% assign reeds_afgelost = nil %}
{% endif %}

{% rollforward reeds_afgelost detail.custom.reeds_afgelost %}

I’m comparing on blanks here instead of zeros to make sure that if the user has explicitly typed ‘0’ in one of the inputs, that this is still rollforwarded.

Kind regards
Wouter