# Custom template "Thin Cap"

**URL:** https://community.silverfin.com/t/custom-template-thin-cap/1923
**Category:** Templates
**Created:** [September 23, 2020, 8:07am UTC](https://community.silverfin.com/t/custom-template-thin-cap/1923 "2020-09-23T08:07:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![AlexanderDB](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@AlexanderDB](https://community.silverfin.com/u/AlexanderDB)
#### Post date: [September 23, 2020, 8:07am UTC](https://community.silverfin.com/t/custom-template-thin-cap/1923/1 "2020-09-23T08:07:03Z")

</div>

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:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/2X/5/591393e5af83451c1727e3600f2b720b2fe2e99b.png)

I have the following code:

```auto
{% 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.

---

<div class="post-metadata">

### Author: ![borjaGonzalez](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/borjagonzalez/32/825_2.png) [@borjaGonzalez](https://community.silverfin.com/u/borjaGonzalez)
#### Post date: [September 23, 2020, 8:21am UTC](https://community.silverfin.com/t/custom-template-thin-cap/1923/2 "2020-09-23T08:21:12Z")

</div>

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:

```auto
{% 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
