Copy data from one period to another for the same template/account

I have the following code (stripped out the non relevant things).
In a knew period, I want to copy the details of the previous period into the active period.
If you try it, you will see that the ‘Aanslagjaar’ is copied, but not the details.
What am i doing wrong that verkoopdetail.omschrijving is not copied.

{% fori detail in current_account.details %}

Aanslagjaar : {% input detail.custom.aanslagjaar %}
{% unless detail.custom.aanslagjaar == blank %}

{% capture verkoop_key %}verkoop_{{ detail.custom.key }}{% endcapture %}

|----------------|—30%—:+
| {% t “Omschrijving” %} |{% t “Datum” %} {% fori verkoopdetail in custom[verkoop_key] %}
|{% input verkoopdetail.omschrijving %}|{% input verkoopdetail.datum %}{% endfori %}

{% endunless detail not persisted %}

{% endfori %}

Hello Katrien,

Could you try renaming your inputs in the fori loop the same as you did with detail.custom.aanslagjaar.

Every variable which has as name like: detail.custom.naam_variabele as a name will be copied from one period to another.

For example:

detail.custom.verkoopdetail_omschrijving
detail.custom.verkoopdetail_datum

Do not forget to change the fori loop to:

{% fori detail in custom[verkoop_key]%}

Please let us know if this does not help you resolve the problem.

Kind regards,

Mathias

Dear Mathias,

This gives the following error :

{% fori detail in current_account.details %}

Aanslagjaar : {% input detail.custom.aanslagjaar %}
{% unless detail.custom.aanslagjaar == blank %}

{% capture verkoop_key %}verkoop_{{ detail.custom.key }}{% endcapture %}

|----------------|—30%—:+
| {% t “Omschrijving” %} |{% t “Datum” %} {% fori detail in custom[verkoop_key] %}
|{% input detail.custom.verkoopdetail_omschrijving %}|{% input detail.custom.verkoopdetail_datum %}{% endfori %}

{% endunless detail not persisted %}

{% endfori %}

Other suggestions ?

Mattias, see my remarks below

Hello Katrien,

Could you please try the following code:

{% fori detail in custom.details %}

Aanslagjaar : {% input detail.aanslagjaar %}
{% unless detail.aanslagjaar == blank %}

{% capture verkoop_key %}verkoop_{{ detail.custom.key }}{% endcapture %}

|----------------|---30%---:+
| {% t "Omschrijving" %} |{% t "Datum" %} {% fori verkoopdetail in custom[verkoop_key] %}
|{% input verkoopdetail.omschrijving %}|{% input verkoopdetail.datum %}{% endfori %}

{% endunless detail not persisted %}

{% endfori %}

Kind regards,

Mathias