# Unsafe variable

**URL:** <https://community.silverfin.com/t/unsafe-variable/1571>\
**Category:** Templates\
**Tags:** guidelines\
**Created:** [October 7, 2019, 7:19am UTC](https://community.silverfin.com/t/unsafe-variable/1571 "2019-10-07T07:19:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@Peter](https://community.silverfin.com/u/Peter)\
**Post date:** [October 7, 2019, 7:19am UTC](https://community.silverfin.com/t/unsafe-variable/1571/1 "2019-10-07T07:19:51Z")

</div>

We now get a message to improve our code when we safe a template. But I’m now getting the message “Unsafe variable names detected: custom[current\_account.number].dagen\_in\_jaar”. Fine but the problem is that I don’t know why it’s not correct and what do I have to take into account to correct this? I’ve a similar variable “custom[current\_account.number].manueel” where I don’t get an warning message.

Can anyone explain me the difference?

---

<div class="post-metadata">

**Author:** ![Michiel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/michiel/32/2364_2.png) [@Michiel](https://community.silverfin.com/u/Michiel)\
**Post date:** [October 7, 2019, 7:34am UTC](https://community.silverfin.com/t/unsafe-variable/1571/2 "2019-10-07T07:34:56Z")

</div>

Goodmorning Peter,

Can you please share the code where those two variables are assigned?

Best regards,

Michiel

---

<div class="post-metadata">

**Author:** ![Peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@Peter](https://community.silverfin.com/u/Peter)\
**Post date:** [October 7, 2019, 7:48am UTC](https://community.silverfin.com/t/unsafe-variable/1571/3 "2019-10-07T07:48:13Z")

</div>

Hi Michiel, here’s a part of the code because all the code is to much (adaptation of the intrest calculation) and spread over 7 parts. This is the only place where these 2 variables are mentioned.

```auto
{% capture keuzetabel %}
|--------------------------------|----10%--|----15%----:+
| **{{ current_account.link }}** | {% ic %}{% input custom[current_account.number].manueel as:select options:rc_types default:'maand' option_values:'dag|maand|kwartaal|jaar' %} | {% if custom[current_account.number].manueel=='dag' %} {% t "Dagen" %}: {% input custom[current_account.number].dagen_in_jaar as:select options:noemer_types default:1 option_values:'1|365|360' assign:noemer %}{% endif %}{% endic %}{% ic %}|{% endic %}
{% endcapture %}

{{ keuzetabel }}
{% assign custom[current_account.number].dagen_in_jaar = noemer %}
{% if current_account.asset_or_expense %}
  {% assign multiplier = 1 %}
{% else %} {% assign multiplier = -1 %}
{% endif %}

```

---

<div class="post-metadata">

**Author:** ![Michiel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/michiel/32/2364_2.png) [@Michiel](https://community.silverfin.com/u/Michiel)\
**Post date:** [October 7, 2019, 7:55am UTC](https://community.silverfin.com/t/unsafe-variable/1571/4 "2019-10-07T07:55:42Z")

</div>

Hi Peter,

The problem is following code: `{% assign custom[current_account.number].dagen_in_jaar = noemer %}`

You can never assign a custom variable like this. Custom variables can only be filled in by using `{% input custom[current_account.number].dagen_in_jaar %}` and enter the value in your template. Based on the piece of code you shared, I tend to say that you can use a local variable instead of a custom variable

Regards,  
Michiel

---

<div class="post-metadata">

**Author:** ![Peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@Peter](https://community.silverfin.com/u/Peter)\
**Post date:** [October 7, 2019, 8:03am UTC](https://community.silverfin.com/t/unsafe-variable/1571/5 "2019-10-07T08:03:04Z")

</div>

Thanks Michiel,

I’ve removed the assign part because this had no use anymore and everything is OK now.
