Automatically copy data to different periods with default string

hi,

i’m building a template in which I want to calculate “Bedrag na beroepsbeperking” using the following columns:
Omschrijving: {{beperking.link}} using {% for beperking in beperking_accounts %} to make a loop
Brutobedrag : {% =$0+ beperking.value | currency %}
Beroepsbeperking (aftrekbaar):
*{% input period.beperking.custom.beroepsbeperking.percentage as:percentage | default:"1" %}* {% assign beroepsperc = period.beperking.custom.beroepsbeperking.percentage as:currency %} {% assign defperc = beroepsperc | default:"1" %} {% assign beroepsbedrag = beperking.value*defperc as:currency %}
Bedrag na beroepsbeperking: {% =$1+ beroepsbedrag | currency %}

Result is a table like this in for example period 31/12/2018:

But when I want to copy these values in collumn “Beroepsbeperking (aftrekbaar)” from one period (31/12/2018) to an other (31/12/2017) then the default value is given in stead of the adjusted vallue.

I cant quite figure out why the default value is given.
What am I doing wrong?

Also can a Template be copied automatically to all existing periods?

Hi Alexander,

your input variable is linked to your period (starts with period. ). Unless it’s a text template, these variables can never be copied/rollforwarded to other periods.

Regards,

Michiel

Michiel,

true,

I’ve made the adjustment:

| {{ beperking.link }}
| {% =$0+ beperking.value | currency %}
{% comment %}beroepspercentage (aftrekbaar) default 100% laten weergeven en automatisch “bedrag na beroepsbeperking” laten berekenen {% endcomment %}
| {% input beperking.custom.beroepsbeperking.percentage as:percentage | default:“1” %}
{% assign beroepsperc = beperking.custom.beroepsbeperking.percentage as:currency %}
{% assign defperc = beroepsperc | default:“1” %}
{% assign beroepsbedrag = beperking.value*defperc as:currency %}
| {% =$1+ beroepsbedrag | currency %}``

But still the defaults are given when template is copied to another period.

Hi,

I still have not found why a certain percentage entered in the “BEROEPSBEPERKING (AFTREKBAAR)” column is not copied to another period.

example:
period 30/06/2015:

I changed the percentage of Erelonen to 50%:

I want to copy this to period 30/06/2016:
the percentage of Erelonen is back 100%, but it should be 50%

for the table I used following Code:

{% for beperking in beperking_accounts %}
{% newline %}
| {{ beperking.link }}
| {% =$0+ beperking.value | currency %}
{% comment %}beroepspercentage (aftrekbaar) default 100% laten weergeven en automatisch “bedrag na beroepsbeperking” laten berekenen {% endcomment %}
|{% input beperking.custom.beroepsbeperking.percentage as:percentage | default:“1” %}
{% assign beroepsperc = beperking.custom.beroepsbeperking.percentage as:currency %}
{% assign defperc = beroepsperc | default:“1” %}
{% assign beroepsbedrag = beperking.value*defperc as:currency %}
| {% =$1+ beroepsbedrag | currency %}

Hi Alexander,

How is your collection beperking_accounts defined? Can you try to change beperking.custom.beroepsbeperking.percentage to beperking.percentage?

Regards,

Michiel

Michiel,

beperking_accounts is defined as follows:

{% assign beperking_accounts = period.accounts.include_zeros | range:custom.range.beperkingen %}

so

{% input beperking.custom.beroepsbeperking.percentage as:percentage | default:“1” %}

sould be

{% input beperking.percentage as:percentage | default:“1” %}

?

Hi Alexander,

In this case your collection will be linked to your period. Best option is to use the key of your forloop to create the input percentage field. The code could look like this

{% for beperking in beperking_accounts %}
{% newline %}
| {{ beperking.link }}
| {% =$0+ beperking.value | currency %}
{% comment %}beroepspercentage (aftrekbaar) default 100% laten weergeven en automatisch “bedrag na beroepsbeperking” laten berekenen {% endcomment %}
{% capture key %}{{ beperking.number }}{% endcapture %}
|{% input custom.percentage[key] as:percentage | default:"1" %}
{% assign beroepsperc = custom.percentage[key] as:currency %}
{% assign defperc = beroepsperc | default:"1" %}
{% assign beroepsbedrag = beperking.value*defperc as:currency %}
| {% =$1+ beroepsbedrag | currency %}

However, to make your code more efficient I would change this:

{% assign beroepsperc = custom.percentage[key] as:currency %}
{% assign defperc = beroepsperc | default:"1" %}

to this:

{% assign defperc = custom.percentage[key] | default:"1" %}

Kind regards,

Michiel

It works!

Thanks!