Documents - if formula

Hi,

We created a template ‘Verslag algemene vergadering FBG’ bases on the Silverfin template Verslag algemene vergadering.

Purpose:

When you select accounts ‘489’ then the sentence ‘De intresten rekening courant worden betaalbaar gesteld per: xx/xx/xxxx’ should appear.

If the colleagues select a ‘416’ account then nothing have to be shown.

Problem:

You have to select all the 489 accounts before SF shows the sentence.

But the sentence is supposed to be shown also when only 1 account ‘489’ is selected.

Code:

{% stripnewlines %}
{% if accounts_rekening_courant == #489 %}
De intresten rekening courant worden betaalbaar gesteld per {% input period.custom.rekening_courant.date as:date placeholder: “dd/mm/yyyy” %}.
{% endif %}
{% endstripnewlines %}

Thanks for helping us out!

Kind regards
Stefanie

Hi @Stefanie, and welcome to the Silverfin Community!

The problem here seems to be the next if statement:

{% if accounts_rekening_courant == #489 %} 

Here, we are comparing the total value of the accounts assigned to ‘accounts_rekening_courant’ with the total value of the accounts that starts with 489. So, as you noticed, it will only be true if all the 489 accounts are selected.

What we can do instead is loop over each of the numbers of the accounts selected. And if one of those contains 489, create a variable (setting it to true) which we are going to use for showing the text.

The code could look like this:

{% for account in accounts_rekening_courant %}
  {% if account.number contains 489 %} 
    {% assign show_message = true %}
  {% endif %}
{% endfor %}

{% stripnewlines %}
{% if show_message %}
De intresten rekening courant worden betaalbaar gesteld per {% input period.custom.rekening_courant.date as:date placeholder: “dd/mm/yyyy” %}.
{% endif %}
{% endstripnewlines %}

Also, it could be created a similar for loop, assigning the same ‘show_message’ variable to false if an 416 account is selected.

Let me know if this solved the problem.

Kind regards
Agustin

It works!!! Thanks a lot!