# Template investments

**URL:** https://community.silverfin.com/t/template-investments/1344
**Category:** Templates
**Tags:** ifi, custom\_template
**Created:** [January 8, 2019, 4:35pm UTC](https://community.silverfin.com/t/template-investments/1344 "2019-01-08T16:35:14Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Yana](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@Yana](https://community.silverfin.com/u/Yana)
#### Post date: [January 8, 2019, 4:35pm UTC](https://community.silverfin.com/t/template-investments/1344/1 "2019-01-08T16:35:14Z")

</div>

Hello

After following the workshops ‘Let’s get technical’ I’ve tried to build a template for the investments “terreinen en gebouwen”.  
See code below:

{% stripnewlines %}  
|Datum  
|Factuur  
|Omschrijving  
|Leverancier  
|Aantal m²  
|Prijs per m²  
|Regime  
|Saldo  
|  
{% newline %}  
|----10%----  
|----7%----  
|----25%----  
|----10%----  
|----10%----  
|----15%----  
|----10%----  
|----15%—:  
|—3%-----+

{% fori admin in period.custom.terreinen %}  
{% newline %}  
| {% input admin.datum as:date %}  
| {% input admin.factuur %}  
| {% input admin.Omschrijving %}  
| {% input admin.Leverancier %}  
| {% input admin.aantalm² %}  
| {% input admin.prijsperm² as:currency %}  
| {% input admin.Regime as:select options:“BTW|Reg.rechten” %}  
| {% $1+input admin.Saldo as:currency %}  
| {% input admin.bijlage as:file %}  
{% endfori %}  
{% newline %}  
| **Terreinen**  
|  
|  
|  
|  
|  
|  
| **{{ $1 | currency }}**  
|

{% endstripnewlines %}

  

{% stripnewlines %}

|----10%----  
|----7%----  
|----25%----  
|----10%----  
|----10%----  
|----15%----  
|----10%----  
|----15%—:  
|—3%-----+

{% fori detail in period.custom.gebouwen %}  
{% newline %}  
| {% input detail.datum as:date %}  
| {% input detail.factuur %}  
| {% input detail.Omschrijving %}  
| {% input detail.Leverancier %}  
| {% input detail.aantalm² %}  
| {% input detail.prijsperm² as:currency %}  
| {% input detail.Regime as:select options:“BTW|Reg.rechten” %}  
| {% $2+input detail.Saldo as:currency %}  
| {% input detail.bijlage as:file %}  
{% endfori %}  
{% newline %}  
| **Gebouwen**  
|  
|  
|  
|  
|  
|  
| **{{ $2 | currency }}**  
|

{% endstripnewlines %}

  

{% stripnewlines %}  
|----10%----  
|----7%----  
|----25%----  
|----10%----  
|----10%----  
|----15%----  
|----10%----  
|----15%—:  
|—3%-----+  
{% newline %}

|_^ **Totaal** ^_  
|_^^_  
|_^^_  
|_^^_  
|_^^_  
|_^^_  
|_^^_  
|_^ **{{ $1+$2 | currency }}** ^_  
|_^^_

{% endstripnewlines %}

  

{% comment %}EXTRA TOELICHTING{% endcomment %}

{% input custom.detail.extra\_toelichting as:text placeholder:‘extra toelichting’ %}

Is it possible to hide for example “terreinen” when it’s zero?  
Is this with an if-statement?

Thanks for your help!

Kinds Regards  
Yana van Landegem  
Van Coile & Partners

---

<div class="post-metadata">

### Author: ![Sofie\_Cleemput](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sofie_cleemput/32/709_2.png) [@Sofie\_Cleemput](https://community.silverfin.com/u/Sofie_Cleemput)
#### Post date: [January 8, 2019, 5:03pm UTC](https://community.silverfin.com/t/template-investments/1344/2 "2019-01-08T17:03:06Z")

</div>

Hi Yana

do you want to hide the block terreinen only in export mode? If so, you can indeed put an ifs statement around terreinen like : `{% ifi period.custom.terreinen == blank %}` . An ifi statement can be seen as an if statement that is always true in input view and depends on the condition in export view.

Hopes this resolves your question?

Please, use the three ``` to paste your code in a post.

Kind regards  
Sofie

---

<div class="post-metadata">

### Author: ![Yana](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@Yana](https://community.silverfin.com/u/Yana)
#### Post date: [January 9, 2019, 7:19pm UTC](https://community.silverfin.com/t/template-investments/1344/3 "2019-01-09T19:19:41Z")

</div>

Hi Sofie

I’m doing something wrong I think. Can you help me please?  
See code below:

"’{% stripnewlines %}  
{% ifi period.custom.terreinen == blank %}  
|Datum  
|Factuur  
|Omschrijving  
|Leverancier  
|Aantal m²  
|Prijs per m²  
|Regime  
|Saldo  
|  
{% newline %}  
|----10%----  
|----7%----  
|----25%----  
|----10%----  
|----10%----  
|----15%----  
|----10%----  
|----15%—:  
|—3%-----+

{% fori admin in period.custom.terreinen %}  
{% newline %}  
| {% input admin.datum as:date %}  
| {% input admin.factuur %}  
| {% input admin.Omschrijving %}  
| {% input admin.Leverancier %}  
| {% input admin.aantalm² %}  
| {% input admin.prijsperm² as:currency %}  
| {% input admin.Regime as:select options:“BTW|Reg.rechten” %}  
| {% $1+input admin.Saldo as:currency %}  
| {% input admin.bijlage as:file %}  
{% endfori %}  
{% newline %}  
| **Terreinen**  
|  
|  
|  
|  
|  
|  
| **{{ $1 | currency }}**  
|  
{% endifi %}  
{% endstripnewlines %}

  

{% stripnewlines %}  
|----10%----  
|----7%----  
|----25%----  
|----10%----  
|----10%----  
|----15%----  
|----10%----  
|----15%—:  
|—3%-----+

{% fori detail in period.custom.gebouwen %}  
{% newline %}  
| {% input detail.datum as:date %}  
| {% input detail.factuur %}  
| {% input detail.Omschrijving %}  
| {% input detail.Leverancier %}  
| {% input detail.aantalm² %}  
| {% input detail.prijsperm² as:currency %}  
| {% input detail.Regime as:select options:“BTW|Reg.rechten” %}  
| {% $2+input detail.Saldo as:currency %}  
| {% input detail.bijlage as:file %}  
{% endfori %}  
{% newline %}  
| **Gebouwen**  
|  
|  
|  
|  
|  
|  
| **{{ $2 | currency }}**  
|

{% endstripnewlines %}

  

{% stripnewlines %}  
|----10%----  
|----7%----  
|----25%----  
|----10%----  
|----10%----  
|----15%----  
|----10%----  
|----15%—:  
|—3%-----+  
{% newline %}

|_^ **Totaal** ^_  
|_^^_  
|_^^_  
|_^^_  
|_^^_  
|_^^_  
|_^^_  
|_^ **{{ $1+$2 | currency }}** ^_  
|_^^_

{% endstripnewlines %}

  

{% comment %}EXTRA TOELICHTING{% endcomment %}

{% input custom.detail.extra\_toelichting as:text placeholder:‘extra toelichting’ %}"’

Thanks for your help!

Kind regards  
Yana

---

<div class="post-metadata">

### Author: ![Sofie\_Cleemput](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sofie_cleemput/32/709_2.png) [@Sofie\_Cleemput](https://community.silverfin.com/u/Sofie_Cleemput)
#### Post date: [January 10, 2019, 8:30am UTC](https://community.silverfin.com/t/template-investments/1344/4 "2019-01-10T08:30:33Z")

</div>

Hi Yana

some small adjustments and tips for your code below (I only adjusted the part ‘terreinen’):

- do you want to use the period.custom? The period is attached to the working period and always changes by changing ‘working period’
- make sure the total size of the columns = 100 %
- the ifi- statement should go into your fori-loop. To make this work, you should work with forloop.last

Maybe, this community post can also help you further:

> [@Ifi-statement depending on fori-statement](https://community.silverfin.com/t/ifi-statement-depending-on-fori-statement/565):
>
> Hi, I’m having some trouble with my ifi-statement in the code below. With the fori statement, nothing will be printed when there’s no content. But in the code below I have a first row that could be seen as title row, this one may not be printed when there is no content. The code I wrote this far doesn’t work. Anyone who could help me? {% ifi bankrekening.rekeningnummer != blank or bankrekening.bank != blank %} {{ header }} {% newline %} |Bankrekening||{% newline %}{% fori bankrekening in cu…

````auto
|Datum
|Factuur
|Omschrijving
|Leverancier
|Aantal m²
|Prijs per m²
|Regime
|Saldo
|
{% newline %}
|-----10%-----
|-----7%-----
|-----20%-----
|-----10%-----
|-----10%-----
|-----15%-----
|-----10%-----
|-----15%-----
|-----3%-----:+
{% fori admin in custom.terreinen %}
{% newline %}
| {% input admin.datum as:date %}
| {% input admin.factuur %}
| {% input admin.Omschrijving %}
| {% input admin.Leverancier %} 
| {% input admin.aantalm² %}
| {% input admin.prijsperm² as:currency %}
| {% input admin.Regime as:select options:“BTW|Reg.rechten” %}
| {% $1+input admin.Saldo as:currency %}
| {% input admin.bijlage as:file %} 
{% if forloop.last %}
{% newline %}
{% ifi admin.Saldo != blank %}
|Terreinen
|
|
| 
|
|
|
|{{ $1 | currency }}
|
{% endifi %}
{% endif %}
{% endfori %}
{% endstripnewlines %}```

Kr 
Sofie
````

---

<div class="post-metadata">

### Author: ![Yana](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@Yana](https://community.silverfin.com/u/Yana)
#### Post date: [January 10, 2019, 4:45pm UTC](https://community.silverfin.com/t/template-investments/1344/5 "2019-01-10T16:45:04Z")

</div>

Thanks Sofie!

---

<div class="post-metadata">

### Author: ![Yana](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@Yana](https://community.silverfin.com/u/Yana)
#### Post date: [January 14, 2019, 7:49am UTC](https://community.silverfin.com/t/template-investments/1344/6 "2019-01-14T07:49:18Z")

</div>

Hi Sofie

Just one more question.  
Can I use the same code when I want the ifi-statement also for the part “gebouwen” when this is zero?

I’ve tried with the same code but I got an error in the export.  
She my code below.

"{% stripnewlines %}  
|Datum  
|Omschrijving  
|Regime  
|Aantal m²  
|Prijs per m²  
|Saldo  
|  
{% newline %}  
|----10%----  
|----27%----  
|----15%----  
|----15%----  
|----15%----  
|----15%—:  
|—3%-----+

{% fori admin in custom.terreinen %}  
{% newline %}  
| {% input admin.datum as:date %}  
| {% input admin.omschrijving %}  
| {% input admin.regime as:select options:“BTW|Registratie” %}  
| {% input admin.aantalm² %}  
| {% input admin.prijsperm² as:currency %}  
| {% $1+input admin.Saldo as:currency %}  
| {% input admin.bijlage as:file %}  
{% if forloop.last %}  
{% newline %}  
{% ifi admin.Saldo != blank %}  
| **Terreinen**  
|  
|  
|  
|  
| **{{ $1 | currency }}**  
|  
{% endifi %}  
{% endif %}  
{% endfori %}  
{% endstripnewlines %}

{% stripnewlines %}  
|----10%----  
|----27%----  
|----15%----  
|----15%----  
|----15%----  
|----15%—:  
|—3%-----+  
{% fori detail in custom.gebouwen %}  
{% newline %}  
| {% input detail.datum as:date %}  
| {% input detail.omschrijving %}  
| {% input detail.regime as:select options:“BTW|Registratie” %}  
| {% input detail.aantalm² %}  
| {% input detail.prijsperm² as:currency %}  
| {% $2+input detail.Saldo as:currency %}  
| {% input detail.bijlage as:file %}  
{% if forloop.last %}  
{% newline %}  
{% ifi detail.Saldo != blank %}  
| **Gebouwen**  
|  
|  
|  
|  
| **{{ $2 | currency }}**  
|  
{% endifi %}  
{% endif %}  
{% endfori %}  
{% endstripnewlines %}

{% stripnewlines %}  
|----10%----  
|----27%----  
|----15%----  
|----15%----  
|----15%----  
|----15%—:  
|—3%-----+  
{% newline %}

|_^ **Totaal** ^_  
|_^^_  
|_^^_  
|_^^_  
|_^^_  
|_^ **{{ $1+$2 | currency }}** ^_  
|_^^_

{% endstripnewlines %}

  

{% comment %}EXTRA TOELICHTING{% endcomment %}

{% input custom.detail.extra\_toelichting as:text placeholder:‘extra toelichting’ %}"

Many thanks for your help!

Kind Regards  
Yana

---

<div class="post-metadata">

### Author: ![robindeclercq](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/robindeclercq/32/472_2.png) [@robindeclercq](https://community.silverfin.com/u/robindeclercq)
#### Post date: [January 14, 2019, 8:27am UTC](https://community.silverfin.com/t/template-investments/1344/7 "2019-01-14T08:27:39Z")

</div>

Hi @Yana,

At first sight, it seems that you’re code should work just fine. Would it be possible to share the error in your export?

When I try to export your table, I do notice that the header is included in the export when the part for ‘Gebouwen’ is empty. This can be fixed by removing the part

> {% endstripnewlines %}
> 
> {% stripnewlines %}  
> |----10%----  
> |----27%----  
> |----15%----  
> |----15%----  
> |----15%----  
> |----15%—:  
> |—3%-----+

around line 39.

Otherwise, in case the part for ‘Gebouwen’ is empty, the table-header is still included in the export without any content in the table for the part ‘Gebouwen’. As the table ‘Gebouwen’ has the same lay-out as the part for ‘Terreinen’ there is no need to define a new table.

If the above is not the error you’re referring to, please share a print screen with the error message so we can guide you further.

Kind regards,  
Robin

---

<div class="post-metadata">

### Author: ![Yana](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@Yana](https://community.silverfin.com/u/Yana)
#### Post date: [January 14, 2019, 10:28am UTC](https://community.silverfin.com/t/template-investments/1344/8 "2019-01-14T10:28:59Z")

</div>

Hi

See the export below:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/1212f66323c87c6dea92ad4dcd219ae92bc09de1.png)

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/f622ddb69702d27ce23f7f703746df75275e67f9.png)

---

<div class="post-metadata">

### Author: ![robindeclercq](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/robindeclercq/32/472_2.png) [@robindeclercq](https://community.silverfin.com/u/robindeclercq)
#### Post date: [January 14, 2019, 10:57am UTC](https://community.silverfin.com/t/template-investments/1344/9 "2019-01-14T10:57:41Z")

</div>

Hi @Yana,

Indeed, that’s what I was talking about in my response above. So, this should resolve your issue:

> {% stripnewlines %}  
> |Datum  
> |Omschrijving  
> |Regime  
> |Aantal m²  
> |Prijs per m²  
> |Saldo  
> |  
> {% newline %}  
> |----10%----  
> |----27%----  
> |----15%----  
> |----15%----  
> |----15%----  
> |----15%–:  
> |–3%-----+
> 
> {% fori admin in custom.terreinen %}  
> {% newline %}  
> | {% input admin.datum as:date %}  
> | {% input admin.omschrijving %}  
> | {% input admin.regime as:select options:“BTW|Registratie” %}  
> | {% input admin.aantalm² %}  
> | {% input admin.prijsperm² as:currency %}  
> | {% $1+input admin.Saldo as:currency %}  
> | {% input admin.bijlage as:file %}  
> {% if forloop.last %}  
> {% newline %}  
> {% ifi admin.Saldo != blank %}  
> |Terreinen  
> |  
> |  
> |  
> |  
> |{{ $1 | currency }}  
> |  
> {% endifi %}  
> {% endif %}  
> {% endfori %}
> 
> {% fori detail in custom.gebouwen %}  
> {% newline %}  
> | {% input detail.datum as:date %}  
> | {% input detail.omschrijving %}  
> | {% input detail.regime as:select options:“BTW|Registratie” %}  
> | {% input detail.aantalm² %}  
> | {% input detail.prijsperm² as:currency %}  
> | {% $2+input detail.Saldo as:currency %}  
> | {% input detail.bijlage as:file %}  
> {% if forloop.last %}  
> {% newline %}  
> {% ifi detail.Saldo != blank %}  
> |Gebouwen  
> |  
> |  
> |  
> |  
> |{{ $2 | currency }}  
> |  
> {% endifi %}  
> {% endif %}  
> {% endfori %}
> 
> {% newline %}
> 
> |^Totaal^  
> |^^  
> |^^  
> |^^  
> |^^  
> |^{{ $1+$2 | currency }}^  
> |^^
> 
> {% endstripnewlines %}
> 
> {% comment %}EXTRA TOELICHTING{% endcomment %}
> 
> {% input custom.detail.extra\_toelichting as:text placeholder:‘extra toelichting’ %}

As you define your table on top of your document, there is no need to define it again for every sub-part. In case one of the parts is empty, the empty table will be shown in your export (that’s the error you get).

Kind regards,  
Robin

---

<div class="post-metadata">

### Author: ![Yana](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@Yana](https://community.silverfin.com/u/Yana)
#### Post date: [January 14, 2019, 1:09pm UTC](https://community.silverfin.com/t/template-investments/1344/10 "2019-01-14T13:09:41Z")

</div>

Yes, thanks it works.

Is it possible to have some ‘space’ between the total of ‘gebouwen’ and the total of my investments?  
That looks better in the export I think.

I’ve tried with an   
, without result.

Kind regards  
Yana

---

<div class="post-metadata">

### Author: ![robindeclercq](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/robindeclercq/32/472_2.png) [@robindeclercq](https://community.silverfin.com/u/robindeclercq)
#### Post date: [January 14, 2019, 1:20pm UTC](https://community.silverfin.com/t/template-investments/1344/11 "2019-01-14T13:20:26Z")

</div>

Hi @Yana,

Sure, you can just add

> {% newline %}  
> |

in your code. This way you create an extra empty row, which will provide some whitespace.

Kind regards,
