{% fori Otherclausule2 in period.custom.OtherClausule2 %} {% assign $1 = 0 %} {% assign $2 = 0 %}
{{ header_text2 }}
|-75%---------------------------------------------------------------------|-----------------------------------------------------------------------------+
| {% input Otherclausule2.Titel as:text placeholder:‘Titel clausule (in hoofdletters om in lijn te zijn met andere titels)’ %}
| {% input Otherclausule2.Vrij as:text placeholder:‘Tekst in de taal van de export omdat de tekst niet automatisch wordt vertaald.’ %}
{% endfori %}
Blockquote
How can I change my code to make it possible to copy the data from previous year to current year without loosing existing date?
The code snippet you provided doesn’t contain quite enough context for me to properly answer your question.
As I mentioned before, by default, custom input values are carried over when you use the Actions → Copy data button in the top-right corner of the Silverfin platform. If you’re not using any rollforward logic in your code (which I don’t see in the snippet you shared) the data should be copied over to the following year as expected.
The Copy data action can only be manipulated when rollforward tags or logic are implemented.
Are you using any rollforward tags or logic elsewhere in your code?
This a very long code and it is only in this place in the code that the copy data does not work. It is the only place with a table.
I think this is because I use period.custom.OtherClausule2 instead of custom.OtherClausule2 But if I change my code then I will lose the data that is already included in it and that is not good.
In addition, I take this information later in a document to have a nice layout for export and custom. OtherClausule2 doesn’t work.
How can I modify my code so that the copy data works without losing data and also that my export works.
You are right. It is true that the rollforward issue comes from the fact that the custom database variables are linked with the period and not with the account template itself. This refers to period.custom.OtherClausule2and custom.OtherClausule2.
We are also advising you to create a new part in the account template and replace the period.custom with a normal custom, as from a certain period. With this logic, the custom fori stays the old period.custom collection and as from a certain date, it looks to the new normal custom database collection. Example:
We can solve this by adding custom rollforward logic in the code for this account template. The first step is to understand that a fori collection works with indexes. For example the variables in the first row are stored in custom.OtherClausule2.OtherClausule2_1.some_keyand those on the second row in custom.OtherClausule2.OtherClausule2_2.some_key. More information on the rollforward of data in the fori collections, can be found here.
In your previous message, you are also referring to the fact that you want the data to be accessible in other templates. For that, you don’t need to link the custom database variable with the period drop. You can work with results or fetching the custom database variable directly by looping over the period.accountsand check account.namespace.key or account.results.some_result_name.
As we work in this template by fiscal year, I will make the change for fiscal 207.
So I modified my code in the following way and it works when I want to copy the data.
{% fori Otherclausule2 in custom.OtherClausules %} {% input Otherclausule2.Titel as:text placeholder:‘Titel clausule (in hoofdletters om in lijn te zijn met andere titels)’ %} {% rollforward Otherclausule2.Titel custom.OtherClausules[forloop.index0].Titel %} {% result ‘Otherclausule2.Titel’ custom.OtherClausules[forloop.index0].Titel %}
{% input Otherclausule2.Vrij as:text placeholder:‘Tekst in de taal van de export omdat de tekst niet automatisch wordt vertaald.’ %} {% rollforward Otherclausule2.Vrij custom.OtherClausules[forloop.index0].Vrij %} {% result ‘Otherclausule2.Vrij’ custom.OtherClausules[forloop.index0].Vrij %}
{% endfori %}
Now I’m trying to get his information in a text template via result tags but it doesn’t work.
{% fori Otherclausule2 in custom.OtherClausules %}
{{ header_text2 }}
|-75%---------------------------------------------------------------------|-----------------------------------------------------------------------------+
| {% input Otherclausule2.Titel as:text placeholder:‘Titel clausule (in hoofdletters om in lijn te zijn met andere titels)’ %} {% rollforward Otherclausule2.Titel custom.OtherClausules[forloop.index0].Titel %}
| {% input Otherclausule2.Vrij as:text placeholder:‘Tekst in de taal van de export omdat de tekst niet automatisch wordt vertaald.’ %} {% rollforward Otherclausule2.Vrij custom.OtherClausules[forloop.index0].Vrij %}
{% endfori %}
In the document that I use for the export I need to see the texts
Thanks for elaborating your use-case and sorry for the delayed reply.
So in this case, where you merely need payloads from the account template in your text file, you probably don’t need results. Results can be useful in case there is defaults for the inputs that need to be taken into account, but I don’t see those in your code example.
Instead, to gather the information from the account template in your text file, we can also just access the custom collection. There is bit of nuance to it, since account templates are not unique and don’t have handles, so we can’t reference them like that. Instead, we should provide a range of accounts and loop through it. So something like this:
{% assign accounts_in_range = period.accounts.include_zeros | range:49 %}
{% for account in accounts_in_range %}
{% for Otherclausule2 in account.custom.OtherClausules %}
{{ Otherclausule2.Titel }}
{{ Otherclausule2.Vrij }}
{% endfor %}
{% endfor %}
I used range 49 in my example, totally random ofc, if you could narrow down the range it would even be better. So we loop through all accounts in the range, and print the payloads stored in account.custom.OtherClausules.