Template investments

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

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

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

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:

|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

Thanks Sofie!

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

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

Hi

See the export below:

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

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

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,