# Template works by costs but not by incomes

**URL:** <https://community.silverfin.com/t/template-works-by-costs-but-not-by-incomes/1323>\
**Category:** Templates\
**Tags:** input, control\_flow, if\
**Created:** [December 17, 2018, 2:44pm UTC](https://community.silverfin.com/t/template-works-by-costs-but-not-by-incomes/1323 "2018-12-17T14:44:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evelyne](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@Evelyne](https://community.silverfin.com/u/Evelyne)\
**Post date:** [December 17, 2018, 2:44pm UTC](https://community.silverfin.com/t/template-works-by-costs-but-not-by-incomes/1323/1 "2018-12-17T14:44:48Z")

</div>

Hi,

I’ve created a template for making a detail of the “regular costs and incoms”, but now I see that I only can ad an attachment (file) by costs and not by incoms…  
Can somebody help me with this?

```auto
{% t= "Bedrag" fr:"Montant" en:"Amount" %}
{% t= "Datum" fr:"Date" en:"Date" %}
{% t= "Leverancier/Klant" fr:"Fournisseur" en:"Supplier" %}
{% t= "Omschrijving" fr:"Libellé" en:"Description" %}
{% t= "title" fr:"titre" en:"tittle" %}
{% t= "datum" fr:"date" en:"date" %}
{% t= "value" fr:"valeur" en:"value" %}
{% t= "journaal" fr:"journale" en:"journal" %}
{% t= "journaaltype" fr:"type de journale" en:"journaltype" %}

{% addnewinputs %}
{% assign details = current_account.details | sort:'date' %}
{% endaddnewinputs %}

|{% t "Datum" %} |{% t "Journaaltype" %} | {% t "Journaal" %} | Nr. | {% t "Leverancier/Klant" %} | {% t "Omschrijving" %} | | 
|------|---|---|---|-------|-------------|--------------|----------|-------:+{% fori detail in current_account.details %}|   
|{% input detail.custom.datum as:date %}|{% input detail.custom.journaaltype as:journaaltype %}|{% input detail.custom.journaal as:journaal %}|{% input detail.custom.nr %}|{% input detail.custom.leverancier %}|{% input detail.custom.omschrijving %}|{% if current_account.liability_or_income %}{%$0+input detail.custom.value as:n_currency%}{% else %}{%$0+input detail.custom.value as:currency%}|{% input detail.custom.doc as:file %}{% endif %}{% endfori %}{% ic %}
| | || | | | | | **{{ multiplier*$0 | currency }}** {% endic %}

```

Kind regards,  
Evelyne

---

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [December 17, 2018, 3:08pm UTC](https://community.silverfin.com/t/template-works-by-costs-but-not-by-incomes/1323/2 "2018-12-17T15:08:50Z")

</div>

Hi @Evelyne,

Your attachment code falls in the second (else) statement of your if-statement (to check if it’s a cost or income account):

```auto
{% if current_account.liability_or_income %}
{%$0+input detail.custom.value as:n_currency%}
{% else %}
{%$0+input detail.custom.value as:currency%}
|
{% input detail.custom.doc as:file %}
{% endif %} 

```

So you could add `{% input detail.custom.doc as:file %}` in the first part of your if-statement as well.

Let us know if it works for you.

---

<div class="post-metadata">

**Author:** ![Evelyne](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@Evelyne](https://community.silverfin.com/u/Evelyne)\
**Post date:** [December 17, 2018, 4:08pm UTC](https://community.silverfin.com/t/template-works-by-costs-but-not-by-incomes/1323/3 "2018-12-17T16:08:43Z")

</div>

> [@sven](#):
>
> {% input detail.custom.doc as:file %}

Hi @sven

It works perfectly now!  
Thanks a lot!

Kind regards,  
Evelyne

---

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [December 17, 2018, 4:20pm UTC](https://community.silverfin.com/t/template-works-by-costs-but-not-by-incomes/1323/4 "2018-12-17T16:20:20Z")

</div>

Closed on December 17, 2018, 4:20pm UTC


