Variables with variable names (eg fiscal parameters)

Evening @Bart_Verhaeghe,

Great question, and I suggest to make less code in your template where you are refering to :

{% assign RevCoe_BelTij_2016 = 4.31 %}
{% assign RevCoe_BelTij_2015 = 4.23 %}

{% capture RevCoe_BelTij %}RevCoe_BelTij_{{ period.year_end_date | date:"%Y" }}{% endcapture %}

The variable {{ RevCoe_BelTij }} will give the result of your capture (RevCoe_BelTij_2016 fi), but if you use this code :

{{ [RevCoe_BelTij] }} it will give the result of the variable (so 4.23 for instance).

This can be linked into a result-tag, like you did :

{% result “coeff” RevCoe_BelTij %} 

In your template where you want to get the result (depending on the book year you’re in), you can use this code from now on :

{{ period.reconciliations.community.results.[coeff] }} 

As you see, if a new coefficient has to be added, you only have to add one line of code in your template where the result tags are in!
So less code is our goal to go for.

Can you try with this information, and let uw know if it did the trick?
Great case! :ok_hand:

:bangbang: You had 2 mistakes in your own code though :

  • You need to use the date-filter | date:"%Y"
  • I’d suggest never to use spaces in a capture, because you can’t have variables with a space in it

:question: PS mind to use the corresponding topic “Templates” in the future, with your code in quotes (more info here, thanks! :relaxed: