Custom template "Thin Cap"

Hi,

I’m having trouble with a custom template “Thin Cap”.
when I select an account, I do not get the selected ranges in to the table.

Note that the interface has changed to select an account:

I have the following code:

{% comment %}let user select range{% endcomment %}
{% ic %}
{::infotext}
{% t "Selecteer, indien nodig, nog bijkomende rekeningen met betrekking tot het " %} **{% t "gestort kapitaal" %}** {% t "om de correcte grens te bepalen." %} 
{% input custom.range.fisc_cap as:account_collection range:"10,11" default:"10,11" accounts_var:accounts %}
{:/infotext}
{% endic %}
{% assign fisc_cap_accounts = period.accounts.include_zeros | range:custom.range.fisc_cap1 %}
{% assign last_year = period.minus_1y.year_end %}

{% comment %}Silverfin community ==> check to see if previous year exists{% endcomment %}
{% if period.minus_1y.exists %}
  {% assign show_nbr_prev_y = true %}
{% endif %}

{% ic %}
{::infotext}
{% t "Selecteer, indien nodig, nog bijkomende rekeningen met betrekking tot de " %} **{% t "belastbare reserves" %}** {% t "om de correcte grens te bepalen." %} {% input custom.range.thin_cap as:account_collection range:"12,130,131,133,14" default:"12,130,131,133,14" accounts_var:accounts %}
{:/infotext}
{% endic %}
{% comment %}create account collection with the selected ranges (including zero accounts!) which are stored in the database variable "custom.range.thin_cap" {% endcomment %}
{% assign thin_cap_accounts = period.accounts.include_zeros | range:custom.range.thin_cap %}
{% assign last_year = period.minus_1y.year_end %}
{% comment %}loop over those selected accounts, and display the previous value as well{% endcomment %}
{% stripnewlines %}
| {% t "Gegevens uit jaarrekening" %}
| {% t "Begintoestand" %}
| {% t "Eindtoestand" %}
| {% t "Basis" %}
| {% t "Max R/C" %}
| Max. Thin Cap  
{% newline %}
| ----25%----
| ----15%----:
| ----15%----:
| ----15%----:
| ------:+
| ------:+
{% ic %}#{% endic %}
{% nic %}+{% endnic %}
{% comment %}loop over accounts{% endcomment %}
{% comment %}loop over accounts{% endcomment %}
{% for fisc_cap in fisc_cap_accounts %}
  {% comment %}your comments{% endcomment %}

  {% newline %}
  {% comment %}display account and number as linkto{% endcomment %}
  | {{ fisc_cap.link }}
  {% comment %}create variable which goes to the period.accounts-drop but in the last period of last book year, filtered on the account number{% endcomment %}
  {% assign value_end_year = last_year.accounts | range:fisc_cap.mapped_number %}
  {% comment %}display new created var "value_end_year"{% endcomment %}
  {% if show_nbr_prev_y %}
  | {% =$2+ -value_end_year | currency %}  
  {% else %}
  | {% $2+input fisc_cap.custom.value.end_year as:currency default:0%}
  {% endif %}
  
{% comment %}display the value in current period, which is the db variable value of the account drop{% endcomment %}
  | {% =$3+ -fisc_cap.value | currency %}
  | {{ -fisc_cap.value | currency }}
  | 
  |
{% endfor %}

{% for account in thin_cap_accounts %}
  {% newline %}
  {% comment %}display account and number as linkto{% endcomment %}
  | {{ account.link }}
{% comment %}create variable which goes to the period.accounts-drop but in the last period of last book year, filtered on the account number{% endcomment %}
{% assign value_end_year = last_year.accounts | range:account.mapped_number %}
  {% comment %}display new created var "value_end_year"{% endcomment %}
  {% if show_nbr_prev_y %}
  | {% =$20+ -value_end_year | currency %}  
  {% else %}
  | {% $20+input account.custom.value.end_year as:currency default:0%}
  {% endif %}

{% comment %}display the value in current period, which is the db variable value of the account drop{% endcomment %}
  | {% =$21+ -account.value | currency %}
  | {{ -value_end_year | currency }}
  | 
  |
{% endfor %}

What could cause this problem?
last week this template worked just fine.

Hi Alexander,

This happens because you have a default range on your account collection and when assigning fisc_cap_accounts you do not include it (custom.range.fisc_cap1 is blank in your example). You need to do the following:

{% assign accounts_range = custom.range.fisc_cap1 | default:'10,11' %}
{% assign fisc_cap_accounts = period.accounts.include_zeros | range:accounts_range %}

Hope that works,

Best,
Borja