# Ifi-statement depending on fori-statement

**URL:** <https://community.silverfin.com/t/ifi-statement-depending-on-fori-statement/565>\
**Category:** Templates\
**Tags:** ifi, control\_flow, iterations, fori\_loop\
**Created:** [January 3, 2018, 1:16pm UTC](https://community.silverfin.com/t/ifi-statement-depending-on-fori-statement/565 "2018-01-03T13:16:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cedric](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@Cedric](https://community.silverfin.com/u/Cedric)\
**Post date:** [January 3, 2018, 1:16pm UTC](https://community.silverfin.com/t/ifi-statement-depending-on-fori-statement/565/1 "2018-01-03T13:16:23Z")

</div>

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?

```auto
{% ifi bankrekening.rekeningnummer != blank or bankrekening.bank != blank %}
{{ header }}

{% newline %}
|Bankrekening||{% newline %}{% fori bankrekening in custom.bankrekening %}
||Rekeningnummer|{% input bankrekening.rekeningnummer %}{% newline %}
||Bank | {% input bankrekening.bank %}{% newline %}{% endfori %}
{% endifi %}
{% endstripnewlines %}
```

---

<div class="post-metadata">

**Author:** ![SamVanEenoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/samvaneenoo/32/134_2.png) [@SamVanEenoo](https://community.silverfin.com/u/SamVanEenoo)\
**Post date:** [January 5, 2018, 1:57pm UTC](https://community.silverfin.com/t/ifi-statement-depending-on-fori-statement/565/2 "2018-01-05T13:57:57Z")

</div>

Try to right your code in the following structure:

> {% fori item in collection %}  
> {% if forloop.first %}  
> header  
> {% endif %}  
> content  
> {% endfori %}

If nothing is in your fori-loop, your header won’t be shown either.
