Ifi-statement depending on fori-statement


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 custom.bankrekening %}
||Rekeningnummer|{% input bankrekening.rekeningnummer %}{% newline %}
||Bank | {% input bankrekening.bank %}{% newline %}{% endfori %}
{% endifi %}
{% endstripnewlines %}

Try to right your code in the following structure:

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

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