Multiple benefits in minutes GM

My collegues asked for the possibility to add multiple miscellaneous benefits. I adapted the code from the original Silverfin-template. The titles are left open.
In most cases this works fine (or good enough :slight_smile: ) . Only in one case the line {% input custom.vaa.vaa1 %} | | {% input custom.vaa.vaa2 %} | | {% input custom.vaa.vaa3 %} is visible in the preview but not in the export.
Has someone maybe some ideas to optimise this code?

Thanks!

{% stripnewlines %}
| {% ifi show_bez_bl or show_extra_bez_bl %}| | Vergoeding{% endifi %}{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | Voordelen alle aard | {% endifi %}
{% newline %}
|:------------------------------------|----10%---|-------|----10%---|-----------|-----------|-----------
{% newline %}
{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | | {% input custom.vaa.vaa1 %} | | {% input custom.vaa.vaa2 %} | | {% input custom.vaa.vaa3 %}
{% newline %}{% endifi %}
|:------------------------------------|----10%---|-------:|----10%---|-----------|----10%---|-----------|----10%---|-----------:
{% for zaakvoerder in period.directors %}
  {% assign words = zaakvoerder.name | split: ' ' %}
  {% assign lastname = "" %}
  {% assign person_first_name = "" %}
  {% for word in words %}
    {% if forloop.last %}
      {% assign person_first_name = word %}
    {% else %}
      {% assign lastname = lastname | append:" " | append:word %}
    {% endif %}
  {% endfor %}
  {% assign bez_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging_range %}
  {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
  {% ifi zaakvoerder.custom.bezoldiging != blank or zaakvoerder.custom.bezoldiging != 0.0 or bez_waarde.value != 0 or zaakvoerder.custom.vaa != blank or zaakvoerder.custom.vaa != 0.0 or vaa_waarde.value != 0.0 %}
  {% newline %}
    | {% if zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name == blank %}{{ zaakvoerder.name }}{% elsif zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name != blank %}{{ zaakvoerder.custom.last_name }} {{ person_first_name }}{% elsif zaakvoerder.custom.first_name != blank and zaakvoerder.custom.last_name == blank %}{{ lastname }} {{ zaakvoerder.custom.first_name }}{% else %}{{ zaakvoerder.custom.last_name }} {{ zaakvoerder.custom.first_name }}{% endif %}    
    {% ifi show_bez_bl or show_extra_bez_bl %}  
      | {% input zaakvoerder.custom.bezoldiging_range as:account_collection range:618,62,74 accounts_var:bez %}
      {% assign abs_bez = bez.6-bez.7 %}
      | {% input zaakvoerder.custom.bezoldiging default:abs_bez as:currency %}
    {% endifi %}
    {% ifi show_vaa_bl or show_extra_vaa_bl %} 
      | {% input zaakvoerder.custom.vaa1_range as:account_collection range:74,618 accounts_var:vaa1 %}
      {% assign abs_vaa1 = vaa1.6-vaa1.7 %}
      |{% input zaakvoerder.custom.vaa1 default:abs_vaa1 as:currency %}
      | {% input zaakvoerder.custom.vaa2_range as:account_collection range:74,618 accounts_var:vaa2 %}
      {% assign abs_vaa2 = vaa2.6-vaa2.7 %}
      |{% input zaakvoerder.custom.vaa2 default:abs_vaa2 as:currency %}
      | {% input zaakvoerder.custom.vaa3_range as:account_collection range:74,618 accounts_var:vaa3 %}
      {% assign abs_vaa3 = vaa3.6-vaa3.7 %}
      |{% input zaakvoerder.custom.vaa3 default:abs_vaa3 as:currency %}
    {% endifi %}
  {% endifi %}
{% endfor %}
{% fori bezoldiging in period.custom.extra_bezoldiging %}
  {% ifi show_extra_bez_bl or show_extra_vaa_bl %}
  {% newline %} 
  | {% input bezoldiging.name %}
    {% ifi show_bez_bl or show_extra_bez_bl %}  
      | {% input bezoldiging.bezoldinging_range as:account_collection range:618,62,74 accounts_var:bez_bez %}    
      {% assign abs_bez_bez = bez_bez.6-bez_bez.7 %}
      | {% input bezoldiging.bedrag default:abs_bez_bez as:currency %}
    {% endifi %}
    {% ifi show_vaa_bl or show_extra_vaa_bl %}
        | {% input bezoldiging.accounts1 as:account_collection range:74,618 accounts_var:extra_vaa1 %}
        {% assign abs_extra_vaa1 = extra_vaa1.6-extra_vaa1.7 %}
        |{% input bezoldiging.vaa1_extra default:abs_extra_vaa1 as:currency %}
        | {% input bezoldiging.accounts2 as:account_collection range:74,618 accounts_var:extra_vaa2 %}
        {% assign abs_extra_vaa2 = extra_vaa2.6-extra_vaa2.7 %}
        |{% input bezoldiging.vaa2_extra default:abs_extra_vaa2 as:currency %}
        | {% input bezoldiging.accounts3 as:account_collection range:74,618 accounts_var:extra_vaa3 %}
        {% assign abs_extra_vaa3 = extra_vaa3.6-extra_vaa3.7 %}
        |{% input bezoldiging.vaa3_extra default:abs_extra_vaa3 as:currency %}
    {% endifi %}
  {% endifi %}
{% endfori %}
{% endstripnewlines %}

{% endifi %}
{:/group}

Hi Lesly,

Your input variables are included in ifi statements. Ifi statements will always show their content in normal view, while the content will only be shown in export when the condition is met.

Now I don’t know the values of show_vaa_bl and show_extra_vaa_bl, but probably your ifi condition returns false. You can find more info regarding ifi statements on our read me.io .

Regards,

Michiel

Thank you @Michiel,

I just copied the code for show_vaa_bl and show_extra_vaa_bl, there’s indeed a new ifi statement. But I don’t get why the condition is met in preview and not in the export. I assumed this was the same “export view”.

{% for zaakvoerder in period.directors.active_as_director %}
  {% if zaakvoerder.custom.vaa != blank or zaakvoerder.custom.vaa1 != 0.0 %}
    {% assign show_vaa_bl = true %}{% break %}
  {% else %}
    {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
    {% if vaa_waarde.value != 0.0 %}
      {% assign show_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{% for bezoldiging in period.custom.extra_bezoldiging %}
  {% if bezoldiging.vaa_extra != blank or bezoldiging.vaa_extra != 0.0 %}
    {% assign show_extra_vaa_bl = true %}{% break %}
  {% else %}
    {% assign extra_vaa_waarde = period.accounts | range:bezoldiging.accounts %}
    {% if extra_vaa_waarde.value != 0.0 %}
      {% assign show_extra_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

I still have no idea why this line isn’t shown in the export for this particular file…

Hi @Lesly,

this is explained here: https://developer.silverfin.com/docs/control-flow#section-ifi

Not sure where exactly you’re stuck with, but let me try again:


{% comment %}create local var and assign it to false{% endcomment %}
{% assign some_var = false %}

{% ifi some_var %}
  {% t "This will be shown in input mode ALWAYS - this will not be shown in export mode IF the condition of the ifi-statement is FALSE" %}
{% endifi %}


{% comment %}do the same but assign it to true{% endcomment %}
{% assign some_var = true %}

{% ifi some_var %}
  {% t "This will be shown in input mode ALWAYS - this will be shown in export mode IF the condition of the ifi-statement is TRUE" %}
{% endifi %}


View in Silverfin:

View in export in Silverfin:

Does this help you further?

@sven, the line is shown in input mode and in preview, but not in export. I don’t get why the condition is true in preview but not in export for this particular line (line 5 of the code).
The same ifi-statement is more than once in this part of the code.

Line 5 of the code is this:

{% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}

which will never be printed, as it is just an assign statement.

Don’t you mean this instead :

    {% if vaa_waarde.value != 0.0 %}
      {% assign show_vaa_bl = true %}{% break %}
      {% endif %}

So the local var show_vaa_bl will be set on true only when the local var vaa_waarde.value has a value different from zero.
And that same local var show_vaa_bl is again used in an ifi-statement.

So, if you’d do this:

{% ifi show_vaa_bl %}
show me something
{% endifi %}

then the sentence “show me something” will never be seen in preview/export mode (those 2 are the same thing mind you) IF show_vaa_bl returns false.

If this still doesn’t help you, perhaps share your whole code as I have the feeling this is going back-and-forth judging on some miscommunication.
And I would really love to help you, so if this doesn’t help you, could you explain in detail, while sharing everything of related code, to me?

So sorry if I can’t help you faster @Lesly

@sven,
I mean this line:

{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | | {% input custom.vaa.vaa1 %} | | {% input custom.vaa.vaa2 %} | | {% input custom.vaa.vaa3 %}

The code you’re looking at is just a copy of the Silverfin-template.

Preview:

Export:
VAA_export

Okay, luckily I recognised the code from the text template General Meeting (as I was under the impression this was complete custom code from you).

In there, you’ll have this:

{% for zaakvoerder in period.directors %}
  {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
  {% assign zaakvoerder_vaa_check = zaakvoerder.custom.vaa | default:vaa_waarde %}
  {% if zaakvoerder_vaa_check != 0 %}
    {% assign show_vaa_bl = true %}{% break %}
  {% endif %}
{% endfor %}

So, what we do here:

{% for zaakvoerder in period.directors %}

We loop over all directors

{% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}

for each director, there is a account collection defined where you select random accounts (stored in the database variable zaakvoerder.custom.vaa_range which is a range, so the local var is actually the amount of all your selected accounts, as assigned to your local var vaa_waarde)

{% assign zaakvoerder_vaa_check = zaakvoerder.custom.vaa | default:vaa_waarde %}

You coudl however also input some custom value into the database variable zaakvoerder.custom.vaa OR just make use of the default shown when you select accounts.
That is why we assign the default to the variable zaakvoerder_vaa_check IF the database variable is empty (which will be the case if you don’t enter data manually)
or
the actual input data (when you enter a number manually) is saved in that variable zaakvoerder_vaa_check.

{% if zaakvoerder_vaa_check != 0 %}

When that same variable is different from zero for a director, we’ll do this:

{% assign show_vaa_bl = true %}{% break %}

So, as soon as one director has a value for zaakvoerder_vaa_check, we will create the local var show_vaa_bl and set it to true, and after that we stop with looping over the directors (which is what the break-tag does).
If the break-tag wouldn’t be there, the last loop (= director) would define the value of show_vaa_bl.
And you want the var show_vaa_bl be set on true if at least one director has a value for zaakvoerder_vaa_check

@Lesly seeing your screenshot, that is not a default Silverfin template. Probably you copied pasted our code (which you can do of course), but be sure to copy all relevant code.

So the code pasted here, was not complete and I couldn’t explain to you how the ifi-statement worked with that local variable show_vaa_bl.

I hope now, you can continue with your code?
If not, then I have to ask to past the relevant code here, where all variables are in there so we can see how they are made.

So for the above explanation - just to be clear - if nobody of the directors has any value for VAA, the output within the ifi-statement will not be shown.
As soon as a director has a value, all output within that ifi-statement will be shown

@sven, I’m really sorry. I can follow your explanation but I still don’t get why the same ifi-statement works on the first line and not on the second one.

In this case there’s only 1 director. There is a value for VAA (2.984,25). {{ show_vaa_bl }} returns true.
The output of the first {% ifi show_vaa_bl or show_extra_vaa_bl %} is shown: “Voordelen alle aard”.
The output of the second {% ifi show_vaa_bl or show_extra_vaa_bl %} is only shown in preview and not in the export (titles).
The output of the third {% ifi show_vaa_bl or show_extra_vaa_bl %} is shown again (the amounts).

The same code in other files works fine.

{% for zaakvoerder in period.directors.active_as_director %}
  {% if zaakvoerder.custom.bezoldiging != blank or zaakvoerder.custom.bezoldiging != 0.0 %}
    {% assign show_bez_bl = true %}{% break %}
  {% else %}
    {% assign bez_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging_range %}
    {% if bez_waarde.value != 0 %}
      {% assign show_bez_bl = true %}{% break %}
    {% endif %}
  {% endif %}
{% endfor %}

{% for zaakvoerder in period.directors.active_as_director %}
  {% if zaakvoerder.custom.vaa != blank or zaakvoerder.custom.vaa1 != 0.0 %}
    {% assign show_vaa_bl = true %}{% break %}
  {% else %}
    {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
    {% if vaa_waarde.value != 0.0 %}
      {% assign show_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{% for bezoldiging in period.custom.extra_bezoldiging %}
  {% if bezoldiging.bedrag != blank or bezoldiging.bedrag != 0.0 %}
    {% assign show_extra_bez_bl = true %}{% break %}
  {% else %}
    {% assign extra_bez_waarde = period.accounts | range:bezoldiging.bezoldinging_range %}
    {% if extra_bez_waarde.value != 0.0 %}
      {% assign show_extra_bez_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{% for bezoldiging in period.custom.extra_bezoldiging %}
  {% if bezoldiging.vaa_extra != blank or bezoldiging.vaa_extra != 0.0 %}
    {% assign show_extra_vaa_bl = true %}{% break %}
  {% else %}
    {% assign extra_vaa_waarde = period.accounts | range:bezoldiging.accounts %}
    {% if extra_vaa_waarde.value != 0.0 %}
      {% assign show_extra_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{::group}

{% stripnewlines %}
| {% ifi show_bez_bl or show_extra_bez_bl %}| | Vergoeding{% endifi %}{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | Voordelen alle aard | {% endifi %}
{% newline %}
|:------------------------------------|----10%---|-------|----10%---|-----------|-----------|-----------
{% newline %}
{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | | {% input custom.vaa.vaa1 %} | | {% input custom.vaa.vaa2 %} | | {% input custom.vaa.vaa3 %}
{% newline %}{% endifi %}
|:------------------------------------|----10%---|-------:|----10%---|-----------|----10%---|-----------|----10%---|-----------:
{% for zaakvoerder in period.directors %}
  {% assign words = zaakvoerder.name | split: ' ' %}
  {% assign lastname = "" %}
  {% assign person_first_name = "" %}
  {% for word in words %}
    {% if forloop.last %}
      {% assign person_first_name = word %}
    {% else %}
      {% assign lastname = lastname | append:" " | append:word %}
    {% endif %}
  {% endfor %}
  {% assign bez_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging_range %}
  {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
  {% ifi zaakvoerder.custom.bezoldiging != blank or zaakvoerder.custom.bezoldiging != 0.0 or bez_waarde.value != 0 or zaakvoerder.custom.vaa != blank or zaakvoerder.custom.vaa != 0.0 or vaa_waarde.value != 0.0 %}
  {% newline %}
    | {% if zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name == blank %}{{ zaakvoerder.name }}{% elsif zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name != blank %}{{ zaakvoerder.custom.last_name }} {{ person_first_name }}{% elsif zaakvoerder.custom.first_name != blank and zaakvoerder.custom.last_name == blank %}{{ lastname }} {{ zaakvoerder.custom.first_name }}{% else %}{{ zaakvoerder.custom.last_name }} {{ zaakvoerder.custom.first_name }}{% endif %}    
    {% ifi show_bez_bl or show_extra_bez_bl %}  
      | {% input zaakvoerder.custom.bezoldiging_range as:account_collection range:618,62,74 accounts_var:bez %}
      {% assign abs_bez = bez.6-bez.7 %}
      | {% input zaakvoerder.custom.bezoldiging default:abs_bez as:currency %}
    {% endifi %}
    {% ifi show_vaa_bl or show_extra_vaa_bl %} 
      | {% input zaakvoerder.custom.vaa1_range as:account_collection range:74,618 accounts_var:vaa1 %}
      {% assign abs_vaa1 = vaa1.6-vaa1.7 %}
      |{% input zaakvoerder.custom.vaa1 default:abs_vaa1 as:currency %}
      | {% input zaakvoerder.custom.vaa2_range as:account_collection range:74,618 accounts_var:vaa2 %}
      {% assign abs_vaa2 = vaa2.6-vaa2.7 %}
      |{% input zaakvoerder.custom.vaa2 default:abs_vaa2 as:currency %}
      | {% input zaakvoerder.custom.vaa3_range as:account_collection range:74,618 accounts_var:vaa3 %}
      {% assign abs_vaa3 = vaa3.6-vaa3.7 %}
      |{% input zaakvoerder.custom.vaa3 default:abs_vaa3 as:currency %}
    {% endifi %}
  {% endifi %}
{% endfor %}
{% fori bezoldiging in period.custom.extra_bezoldiging %}
  {% ifi show_extra_bez_bl or show_extra_vaa_bl %}
  {% newline %} 
  | {% input bezoldiging.name %}
    {% ifi show_bez_bl or show_extra_bez_bl %}  
      | {% input bezoldiging.bezoldinging_range as:account_collection range:618,62,74 accounts_var:bez_bez %}    
      {% assign abs_bez_bez = bez_bez.6-bez_bez.7 %}
      | {% input bezoldiging.bedrag default:abs_bez_bez as:currency %}
    {% endifi %}
    {% ifi show_vaa_bl or show_extra_vaa_bl %}
        | {% input bezoldiging.accounts1 as:account_collection range:74,618 accounts_var:extra_vaa1 %}
        {% assign abs_extra_vaa1 = extra_vaa1.6-extra_vaa1.7 %}
        |{% input bezoldiging.vaa1_extra default:abs_extra_vaa1 as:currency %}
        | {% input bezoldiging.accounts2 as:account_collection range:74,618 accounts_var:extra_vaa2 %}
        {% assign abs_extra_vaa2 = extra_vaa2.6-extra_vaa2.7 %}
        |{% input bezoldiging.vaa2_extra default:abs_extra_vaa2 as:currency %}
        | {% input bezoldiging.accounts3 as:account_collection range:74,618 accounts_var:extra_vaa3 %}
        {% assign abs_extra_vaa3 = extra_vaa3.6-extra_vaa3.7 %}
        |{% input bezoldiging.vaa3_extra default:abs_extra_vaa3 as:currency %}
    {% endifi %}
  {% endifi %}
{% endfori %}
{% endstripnewlines %}

{:/group}

I see now @Lesly, not all code is looking at the newly made inputs for vaa1, vaa2, …

Take this code eg:

{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | | {% input custom.vaa.vaa1 %} | | {% input custom.vaa.vaa2 %} | | {% input custom.vaa.vaa3 %}
{% newline %}{% endifi %}

So, in your example this is not shown in export, which we can investigate by looking at the definition of the vars show_vaa_bl and show_extra_vaa_bl

Let’s tackle the local var show_vaa_bl

If we look that up on how it is defined, we see this code:

{% for zaakvoerder in period.directors.active_as_director %}
  {% if zaakvoerder.custom.vaa != blank or zaakvoerder.custom.vaa1 != 0.0 %}
    {% assign show_vaa_bl = true %}{% break %}
  {% else %}
    {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
    {% if vaa_waarde.value != 0.0 %}
      {% assign show_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

Now, first of all, you loop over period.directors to show all the directors, while here you loop over period.people.active_as_director.
I’d fix this to period.people as well here.

Secondly, in the code we see the database variable zaakvoerder.custom.vaa that is nowhere to be found or used in the code.

So this statement :

{% if zaakvoerder.custom.vaa != blank or zaakvoerder.custom.vaa1 != 0.0 %}

could very well be not true at all, which causes us to look at the else-statement:

    {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
    {% if vaa_waarde.value != 0.0 %}
      {% assign show_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %} 

And this will also do nothing for our local variable show_vaa_bl as the database variable used for the selected accounts, is also not used because it is linked to a database variable that is not linked at all for vaa1:

zaakvoerder.custom.vaa_range

So we have a situation here where the local var show_vaa_bl will never be set on true because it is looking at database variables that do not exist.

Actually, the code needs to be changed into this:


{% for zaakvoerder in period.directors %}
  {% if zaakvoerder.custom.vaa1 != blank or zaakvoerder.custom.vaa1 != 0.0 %}
    {% assign show_vaa_bl = true %}{% break %}
  {% else %}
    {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa1_range %}
    {% if vaa_waarde.value != 0.0 %}
      {% assign show_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

See what changed here? We look at the correct database variables linked to vaa 1 :

zaakvoerder.custom.vaa1

and

zaakvoerder.custom.vaa1_range

You should change some code actually, to make it work as well with vaa2 and vaa3 and I don’t see that anywhere.

Hi Sven, thank you. I forgot to adapt the original “vaa” after dividing them.
For now we don’t use the ranges. Can I just copy this for each vaa-range, see below?

I changed the code like you proposed. In this case vaa1 is filled in manually. The line is still missing in export. Preview is fine.

{% for zaakvoerder in period.directors %}
  {% if zaakvoerder.custom.bezoldiging != blank or zaakvoerder.custom.bezoldiging != 0.0 %}
    {% assign show_bez_bl = true %}{% break %}
  {% else %}
    {% assign bez_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging_range %}
    {% if bez_waarde.value != 0 %}
      {% assign show_bez_bl = true %}{% break %}
    {% endif %}
  {% endif %}
{% endfor %}

{% for zaakvoerder in period.directors %}
  {% if zaakvoerder.custom.vaa1 != blank or zaakvoerder.custom.vaa1 != 0.0 %}
    {% assign show_vaa_bl = true %}{% break %}
  {% else %}
    {% assign vaa_waarde1 = period.accounts | range:zaakvoerder.custom.vaa1_range %}
    {% assign vaa_waarde2 = period.accounts | range:zaakvoerder.custom.vaa2_range %}
    {% assign vaa_waarde3 = period.accounts | range:zaakvoerder.custom.vaa3_range %}
    {% if vaa_waarde1.value != 0.0 or vaa_waarde2.value != 0.0 or vaa_waarde3.value != 0.0 %}
      {% assign show_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{% for bezoldiging in period.custom.extra_bezoldiging %}
  {% if bezoldiging.bedrag != blank or bezoldiging.bedrag != 0.0 %}
    {% assign show_extra_bez_bl = true %}{% break %}
  {% else %}
    {% assign extra_bez_waarde = period.accounts | range:bezoldiging.bezoldinging_range %}
    {% if extra_bez_waarde.value != 0.0 %}
      {% assign show_extra_bez_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{% for bezoldiging in period.custom.extra_bezoldiging %}
  {% if bezoldiging.vaa_extra != blank or bezoldiging.vaa_extra != 0.0 %}
    {% assign show_extra_vaa_bl = true %}{% break %}
  {% else %}
    {% assign extra_vaa_waarde = period.accounts | range:bezoldiging.accounts %}
    {% if extra_vaa_waarde.value != 0.0 %}
      {% assign show_extra_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{{ show_vaa_bl }}

{::group}

{% stripnewlines %}
| {% ifi show_bez_bl or show_extra_bez_bl %}| | Vergoeding{% endifi %}{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | Voordelen alle aard | {% endifi %}
{% newline %}
|:------------------------------------|----10%---|-------|----10%---|-----------|-----------|-----------
{% newline %}
{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | | {% input custom.vaa.vaa1 %} | | {% input custom.vaa.vaa2 %} | | {% input custom.vaa.vaa3 %}
{% newline %}{% endifi %}
|:------------------------------------|----10%---|-------:|----10%---|-----------|----10%---|-----------|----10%---|-----------:
{% for zaakvoerder in period.directors %}
  {% assign words = zaakvoerder.name | split: ' ' %}
  {% assign lastname = "" %}
  {% assign person_first_name = "" %}
  {% for word in words %}
    {% if forloop.last %}
      {% assign person_first_name = word %}
    {% else %}
      {% assign lastname = lastname | append:" " | append:word %}
    {% endif %}
  {% endfor %}
  {% assign bez_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging_range %}
  {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
  {% ifi zaakvoerder.custom.bezoldiging != blank or zaakvoerder.custom.bezoldiging != 0.0 or bez_waarde.value != 0 or zaakvoerder.custom.vaa != blank or zaakvoerder.custom.vaa != 0.0 or vaa_waarde.value != 0.0 %}
  {% newline %}
    | {% if zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name == blank %}{{ zaakvoerder.name }}{% elsif zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name != blank %}{{ zaakvoerder.custom.last_name }} {{ person_first_name }}{% elsif zaakvoerder.custom.first_name != blank and zaakvoerder.custom.last_name == blank %}{{ lastname }} {{ zaakvoerder.custom.first_name }}{% else %}{{ zaakvoerder.custom.last_name }} {{ zaakvoerder.custom.first_name }}{% endif %}    
    {% ifi show_bez_bl or show_extra_bez_bl %}  
      | {% input zaakvoerder.custom.bezoldiging_range as:account_collection range:618,62,74 accounts_var:bez %}
      {% assign abs_bez = bez.6-bez.7 %}
      | {% input zaakvoerder.custom.bezoldiging default:abs_bez as:currency %}
    {% endifi %}
    {% ifi show_vaa_bl or show_extra_vaa_bl %} 
      | {% input zaakvoerder.custom.vaa1_range as:account_collection range:74,618 accounts_var:vaa1 %}
      {% assign abs_vaa1 = vaa1.6-vaa1.7 %}
      |{% input zaakvoerder.custom.vaa1 default:abs_vaa1 as:currency %}
      | {% input zaakvoerder.custom.vaa2_range as:account_collection range:74,618 accounts_var:vaa2 %}
      {% assign abs_vaa2 = vaa2.6-vaa2.7 %}
      |{% input zaakvoerder.custom.vaa2 default:abs_vaa2 as:currency %}
      | {% input zaakvoerder.custom.vaa3_range as:account_collection range:74,618 accounts_var:vaa3 %}
      {% assign abs_vaa3 = vaa3.6-vaa3.7 %}
      |{% input zaakvoerder.custom.vaa3 default:abs_vaa3 as:currency %}
    {% endifi %}
  {% endifi %}
{% endfor %}
{% fori bezoldiging in period.custom.extra_bezoldiging %}
  {% ifi show_extra_bez_bl or show_extra_vaa_bl %}
  {% newline %} 
  | {% input bezoldiging.name %}
    {% ifi show_bez_bl or show_extra_bez_bl %}  
      | {% input bezoldiging.bezoldinging_range as:account_collection range:618,62,74 accounts_var:bez_bez %}    
      {% assign abs_bez_bez = bez_bez.6-bez_bez.7 %}
      | {% input bezoldiging.bedrag default:abs_bez_bez as:currency %}
    {% endifi %}
    {% ifi show_vaa_bl or show_extra_vaa_bl %}
        | {% input bezoldiging.accounts1 as:account_collection range:74,618 accounts_var:extra_vaa1 %}
        {% assign abs_extra_vaa1 = extra_vaa1.6-extra_vaa1.7 %}
        |{% input bezoldiging.vaa1_extra default:abs_extra_vaa1 as:currency %}
        | {% input bezoldiging.accounts2 as:account_collection range:74,618 accounts_var:extra_vaa2 %}
        {% assign abs_extra_vaa2 = extra_vaa2.6-extra_vaa2.7 %}
        |{% input bezoldiging.vaa2_extra default:abs_extra_vaa2 as:currency %}
        | {% input bezoldiging.accounts3 as:account_collection range:74,618 accounts_var:extra_vaa3 %}
        {% assign abs_extra_vaa3 = extra_vaa3.6-extra_vaa3.7 %}
        |{% input bezoldiging.vaa3_extra default:abs_extra_vaa3 as:currency %}
    {% endifi %}
  {% endifi %}
{% endfori %}
{% endstripnewlines %}

{:/group}

Hi Lesly,

I notice the following variable is not defined

zaakvoerder.custom.vaa1 

Is this on purpose?

Kind regards,

Michiel

@Michiel, same input as in the Silverfin-template with additional “1”:

| {% input zaakvoerder.custom.vaa1_range as:account_collection range:74,618 accounts_var:vaa1 %}
{% assign abs_vaa1 = vaa1.6-vaa1.7 %}
|{% input zaakvoerder.custom.vaa1 default:abs_vaa1 as:currency %}

Hi @Lesly,

You were still missing a small part in your code related to vaa2 and vaa3 where you assign show_vaa_bl. I added this in your code below (see line 13 of the code below)

{% for zaakvoerder in period.directors %}
  {% if zaakvoerder.custom.bezoldiging != blank or zaakvoerder.custom.bezoldiging != 0.0 %}
    {% assign show_bez_bl = true %}{% break %}
  {% else %}
    {% assign bez_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging_range %}
    {% if bez_waarde.value != 0 %}
      {% assign show_bez_bl = true %}{% break %}
    {% endif %}
  {% endif %}
{% endfor %}

{% for zaakvoerder in period.directors %}
  {% if zaakvoerder.custom.vaa1 != blank or zaakvoerder.custom.vaa1 != 0.0 or zaakvoerder.custom.vaa2 != blank or zaakvoerder.custom.vaa2 != 0.0 or zaakvoerder.custom.vaa3 != blank or zaakvoerder.custom.vaa3 != 0.0 %}
    {% assign show_vaa_bl = true %}{% break %}
  {% else %}
    {% assign vaa_waarde1 = period.accounts | range:zaakvoerder.custom.vaa1_range %}
    {% assign vaa_waarde2 = period.accounts | range:zaakvoerder.custom.vaa2_range %}
    {% assign vaa_waarde3 = period.accounts | range:zaakvoerder.custom.vaa3_range %}
    {% if vaa_waarde1.value != 0.0 or vaa_waarde2.value != 0.0 or vaa_waarde3.value != 0.0 %}
      {% assign show_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{% for bezoldiging in period.custom.extra_bezoldiging %}
  {% if bezoldiging.bedrag != blank or bezoldiging.bedrag != 0.0 %}
    {% assign show_extra_bez_bl = true %}{% break %}
  {% else %}
    {% assign extra_bez_waarde = period.accounts | range:bezoldiging.bezoldinging_range %}
    {% if extra_bez_waarde.value != 0.0 %}
      {% assign show_extra_bez_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{% for bezoldiging in period.custom.extra_bezoldiging %}
  {% if bezoldiging.vaa_extra != blank or bezoldiging.vaa_extra != 0.0 %}
    {% assign show_extra_vaa_bl = true %}{% break %}
  {% else %}
    {% assign extra_vaa_waarde = period.accounts | range:bezoldiging.accounts %}
    {% if extra_vaa_waarde.value != 0.0 %}
      {% assign show_extra_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{{ show_vaa_bl }}

{::group}

{% stripnewlines %}
| {% ifi show_bez_bl or show_extra_bez_bl %}| | Vergoeding{% endifi %}{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | Voordelen alle aard | {% endifi %}
{% newline %}
|:------------------------------------|----10%---|-------|----10%---|-----------|-----------|-----------
{% newline %}
{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | | {% input custom.vaa.vaa1 %} | | {% input custom.vaa.vaa2 %} | | {% input custom.vaa.vaa3 %}
{% newline %}{% endifi %}
|:------------------------------------|----10%---|-------:|----10%---|-----------|----10%---|-----------|----10%---|-----------:
{% for zaakvoerder in period.directors %}
  {% assign words = zaakvoerder.name | split: ' ' %}
  {% assign lastname = "" %}
  {% assign person_first_name = "" %}
  {% for word in words %}
    {% if forloop.last %}
      {% assign person_first_name = word %}
    {% else %}
      {% assign lastname = lastname | append:" " | append:word %}
    {% endif %}
  {% endfor %}
  {% assign bez_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging_range %}
  {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
  {% ifi zaakvoerder.custom.bezoldiging != blank or zaakvoerder.custom.bezoldiging != 0.0 or bez_waarde.value != 0 or zaakvoerder.custom.vaa != blank or zaakvoerder.custom.vaa != 0.0 or vaa_waarde.value != 0.0 %}
  {% newline %}
    | {% if zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name == blank %}{{ zaakvoerder.name }}{% elsif zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name != blank %}{{ zaakvoerder.custom.last_name }} {{ person_first_name }}{% elsif zaakvoerder.custom.first_name != blank and zaakvoerder.custom.last_name == blank %}{{ lastname }} {{ zaakvoerder.custom.first_name }}{% else %}{{ zaakvoerder.custom.last_name }} {{ zaakvoerder.custom.first_name }}{% endif %}    
    {% ifi show_bez_bl or show_extra_bez_bl %}  
      | {% input zaakvoerder.custom.bezoldiging_range as:account_collection range:618,62,74 accounts_var:bez %}
      {% assign abs_bez = bez.6-bez.7 %}
      | {% input zaakvoerder.custom.bezoldiging default:abs_bez as:currency %}
    {% endifi %}
    {% ifi show_vaa_bl or show_extra_vaa_bl %} 
      | {% input zaakvoerder.custom.vaa1_range as:account_collection range:74,618 accounts_var:vaa1 %}
      {% assign abs_vaa1 = vaa1.6-vaa1.7 %}
      |{% input zaakvoerder.custom.vaa1 default:abs_vaa1 as:currency %}
      | {% input zaakvoerder.custom.vaa2_range as:account_collection range:74,618 accounts_var:vaa2 %}
      {% assign abs_vaa2 = vaa2.6-vaa2.7 %}
      |{% input zaakvoerder.custom.vaa2 default:abs_vaa2 as:currency %}
      | {% input zaakvoerder.custom.vaa3_range as:account_collection range:74,618 accounts_var:vaa3 %}
      {% assign abs_vaa3 = vaa3.6-vaa3.7 %}
      |{% input zaakvoerder.custom.vaa3 default:abs_vaa3 as:currency %}
    {% endifi %}
  {% endifi %}
{% endfor %}
{% fori bezoldiging in period.custom.extra_bezoldiging %}
  {% ifi show_extra_bez_bl or show_extra_vaa_bl %}
  {% newline %} 
  | {% input bezoldiging.name %}
    {% ifi show_bez_bl or show_extra_bez_bl %}  
      | {% input bezoldiging.bezoldinging_range as:account_collection range:618,62,74 accounts_var:bez_bez %}    
      {% assign abs_bez_bez = bez_bez.6-bez_bez.7 %}
      | {% input bezoldiging.bedrag default:abs_bez_bez as:currency %}
    {% endifi %}
    {% ifi show_vaa_bl or show_extra_vaa_bl %}
        | {% input bezoldiging.accounts1 as:account_collection range:74,618 accounts_var:extra_vaa1 %}
        {% assign abs_extra_vaa1 = extra_vaa1.6-extra_vaa1.7 %}
        |{% input bezoldiging.vaa1_extra default:abs_extra_vaa1 as:currency %}
        | {% input bezoldiging.accounts2 as:account_collection range:74,618 accounts_var:extra_vaa2 %}
        {% assign abs_extra_vaa2 = extra_vaa2.6-extra_vaa2.7 %}
        |{% input bezoldiging.vaa2_extra default:abs_extra_vaa2 as:currency %}
        | {% input bezoldiging.accounts3 as:account_collection range:74,618 accounts_var:extra_vaa3 %}
        {% assign abs_extra_vaa3 = extra_vaa3.6-extra_vaa3.7 %}
        |{% input bezoldiging.vaa3_extra default:abs_extra_vaa3 as:currency %}
    {% endifi %}
  {% endifi %}
{% endfori %}
{% endstripnewlines %}

{:/group}

Kind regards,
Kimberly

@Kimberly_Vlietinck, thank you for the completion related to vaa2 and vaa3.

In the case above only vaa1 has a value, so this shouldn’t have impact. The titles are still missing in the export :frowning:

Hi @Lesly,

I can’t seem to simulate your issue. Could you perhaps post a screenshot of your input and your export so we can investigate further?

Kind regards,
Kimberly

Hi @Kimberly_Vlietinck,

This is the input:
VAA_input

Preview and export are a few posts earlier.
I encounter this issue only in one particular file. For other companies it’s works fine.

Hi @Lesly,

I took another look and there were still some conditions missing around the logic in the code where you assign show_extra_bez_bl and show_extra_vaa_bl.

The below code with adjustments seems to work for me now. Can you give it a try?

{% for zaakvoerder in period.directors %}
  {% if zaakvoerder.custom.bezoldiging != blank or zaakvoerder.custom.bezoldiging != 0.0 %}
    {% assign show_bez_bl = true %}{% break %}
  {% else %}
    {% assign bez_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging_range %}
    {% if bez_waarde.value != 0 %}
      {% assign show_bez_bl = true %}{% break %}
    {% endif %}
  {% endif %}
{% endfor %}

{% for zaakvoerder in period.directors %}
  {% if zaakvoerder.custom.vaa1 != blank or zaakvoerder.custom.vaa1 != 0.0 or zaakvoerder.custom.vaa2 != blank or zaakvoerder.custom.vaa2 != 0.0 or zaakvoerder.custom.vaa3 != blank or zaakvoerder.custom.vaa3 != 0.0 %}
    {% assign show_vaa_bl = true %}{% break %}
  {% else %}
    {% assign vaa_waarde1 = period.accounts | range:zaakvoerder.custom.vaa1_range %}
    {% assign vaa_waarde2 = period.accounts | range:zaakvoerder.custom.vaa2_range %}
    {% assign vaa_waarde3 = period.accounts | range:zaakvoerder.custom.vaa3_range %}
    {% if vaa_waarde1.value != 0.0 or vaa_waarde2.value != 0.0 or vaa_waarde3.value != 0.0 %}
      {% assign show_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{% for bezoldiging in period.custom.extra_bezoldiging %}
  {% assign bez_bez = period.accounts | range:bezoldiging.bezoldinging_range %}
  {% assign abs_bez_bez = bez_bez.6-bez_bez.7 %}
  {% assign bezoldiging_bedrag = bezoldiging.bedrag | default:abs_bez_bez %}
  {% if bezoldiging_bedrag != blank or bezoldiging_bedrag != 0.0 %}
    {% assign show_extra_bez_bl = true %}{% break %}
  {% else %}
    {% assign extra_bez_waarde = period.accounts | range:bezoldiging.bezoldinging_range %}
    {% if extra_bez_waarde.value != 0.0 %}
      {% assign show_extra_bez_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}

{% for bezoldiging in period.custom.extra_bezoldiging %}
  {% assign def_bezoldiging_vaa1_extra = period.accounts | range:bezoldiging.accounts1 %}
  {% assign bezoldiging_vaa1_extra = bezoldiging.vaa1_extra | default:def_bezoldiging_vaa1_extra.value %}
  {% assign def_bezoldiging_vaa2_extra = period.accounts | range:bezoldiging.accounts2 %}
  {% assign bezoldiging_vaa2_extra = bezoldiging.vaa2_extra | default:def_bezoldiging_vaa2_extra.value %}
  {% assign def_bezoldiging_vaa3_extra = period.accounts | range:bezoldiging.accounts3 %}
  {% assign bezoldiging_vaa3_extra = bezoldiging.vaa3_extra | default:def_bezoldiging_vaa3_extra.value %}
  {% if bezoldiging_vaa1_extra != blank or bezoldiging_vaa1_extra != 0.0 or bezoldiging_vaa2_extra != blank or bezoldiging_vaa2_extra != 0.0 or bezoldiging_vaa3_extra != blank or bezoldiging_vaa3_extra != 0.0 %}
    {% assign show_extra_vaa_bl = true %}{% break %}
  {% else %}
    {% assign extra_vaa_waarde = period.accounts | range:bezoldiging.accounts %}
    {% if extra_vaa_waarde.value != 0.0 %}
      {% assign show_extra_vaa_bl = true %}{% break %}
      {% endif %}
  {% endif %}
{% endfor %}


{::group}

{% stripnewlines %}
| {% ifi show_bez_bl or show_extra_bez_bl %}| | Vergoeding{% endifi %}{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | Voordelen alle aard | {% endifi %}
{% newline %}
|:------------------------------------|----10%---|-------|----10%---|-----------|-----------|-----------
{% newline %}
{% ifi show_vaa_bl or show_extra_vaa_bl %}| | | | | {% input custom.vaa.vaa1 %} | | {% input custom.vaa.vaa2 %} | | {% input custom.vaa.vaa3 %}
{% newline %}{% endifi %}
|:------------------------------------|----10%---|-------:|----10%---|-----------|----10%---|-----------|----10%---|-----------:
{% for zaakvoerder in period.directors %}
  {% assign words = zaakvoerder.name | split: ' ' %}
  {% assign lastname = "" %}
  {% assign person_first_name = "" %}
  {% for word in words %}
    {% if forloop.last %}
      {% assign person_first_name = word %}
    {% else %}
      {% assign lastname = lastname | append:" " | append:word %}
    {% endif %}
  {% endfor %}
  {% assign bez_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging_range %}
  {% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
  {% ifi zaakvoerder.custom.bezoldiging != blank or zaakvoerder.custom.bezoldiging != 0.0 or bez_waarde.value != 0 or zaakvoerder.custom.vaa != blank or zaakvoerder.custom.vaa != 0.0 or vaa_waarde.value != 0.0 %}
  {% newline %}
    | {% if zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name == blank %}{{ zaakvoerder.name }}{% elsif zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name != blank %}{{ zaakvoerder.custom.last_name }} {{ person_first_name }}{% elsif zaakvoerder.custom.first_name != blank and zaakvoerder.custom.last_name == blank %}{{ lastname }} {{ zaakvoerder.custom.first_name }}{% else %}{{ zaakvoerder.custom.last_name }} {{ zaakvoerder.custom.first_name }}{% endif %}    
    {% ifi show_bez_bl or show_extra_bez_bl %}  
      | {% input zaakvoerder.custom.bezoldiging_range as:account_collection range:618,62,74 accounts_var:bez %}
      {% assign abs_bez = bez.6-bez.7 %}
      | {% input zaakvoerder.custom.bezoldiging default:abs_bez as:currency %}
    {% endifi %}
    {% ifi show_vaa_bl or show_extra_vaa_bl %} 
      | {% input zaakvoerder.custom.vaa1_range as:account_collection range:74,618 accounts_var:vaa1 %}
      {% assign abs_vaa1 = vaa1.6-vaa1.7 %}
      |{% input zaakvoerder.custom.vaa1 default:abs_vaa1 as:currency %}
      | {% input zaakvoerder.custom.vaa2_range as:account_collection range:74,618 accounts_var:vaa2 %}
      {% assign abs_vaa2 = vaa2.6-vaa2.7 %}
      |{% input zaakvoerder.custom.vaa2 default:abs_vaa2 as:currency %}
      | {% input zaakvoerder.custom.vaa3_range as:account_collection range:74,618 accounts_var:vaa3 %}
      {% assign abs_vaa3 = vaa3.6-vaa3.7 %}
      |{% input zaakvoerder.custom.vaa3 default:abs_vaa3 as:currency %}
    {% endifi %}
  {% endifi %}
{% endfor %}
{% fori bezoldiging in period.custom.extra_bezoldiging %}
  {% ifi show_extra_bez_bl or show_extra_vaa_bl %}
  {% newline %} 
  | {% input bezoldiging.name %}
    {% ifi show_bez_bl or show_extra_bez_bl %}  
      | {% input bezoldiging.bezoldinging_range as:account_collection range:618,62,74 accounts_var:bez_bez %}    
      {% assign abs_bez_bez = bez_bez.6-bez_bez.7 %}
      | {% input bezoldiging.bedrag default:abs_bez_bez as:currency %}
    {% endifi %}
    {% ifi show_vaa_bl or show_extra_vaa_bl %}
        | {% input bezoldiging.accounts1 as:account_collection range:74,618 accounts_var:extra_vaa1 %}
        {% assign abs_extra_vaa1 = extra_vaa1.6-extra_vaa1.7 %}
        |{% input bezoldiging.vaa1_extra default:abs_extra_vaa1 as:currency %}
        | {% input bezoldiging.accounts2 as:account_collection range:74,618 accounts_var:extra_vaa2 %}
        {% assign abs_extra_vaa2 = extra_vaa2.6-extra_vaa2.7 %}
        |{% input bezoldiging.vaa2_extra default:abs_extra_vaa2 as:currency %}
        | {% input bezoldiging.accounts3 as:account_collection range:74,618 accounts_var:extra_vaa3 %}
        {% assign abs_extra_vaa3 = extra_vaa3.6-extra_vaa3.7 %}
        |{% input bezoldiging.vaa3_extra default:abs_extra_vaa3 as:currency %}
    {% endifi %}
  {% endifi %}
{% endfori %}
{% endstripnewlines %}

{:/group}

Kind regards,
Kimberly