Shareholders are natural

Hi,

In this case I’m trying to get some questions appearing depending on if my shareholders are natural or not.
If 1 of my shareholders is a natural person I should be able to get other questions.
If all my shareholders are legal, the questions should not be appearing.

My code is

{% if shareholder.custom.represented_by_name != blank %}
  {% assign default_type = "legal" %}
{% else %}
  {% assign default_type = "nature" %}
{% endif %}
{% ic %}{% if default_type == "nature" %}De aandeelhouders zijn natuurlijke personen{% endif %}{% endic %}

{% if shareholder.custom.represented_by_vat != blank %}De aandeelhouders zijn geen natuurlijke personen, VVPRbis is niet van toepassing.{% endif %}
{% if shareholder.custom.represented_by_vat == blank %}Minstens 1 aandeelhouder is een natuurlijk persoon. Vervolledig volgende vragen ifv. de voorwaarden van VVPRbis. 
Is de vennootschap opgericht na 01/07/2013 of is er nieuwe inbreng in geld? {% input custom.check.vvpr as:select options:"Ja|Nee" %}
{% if custom.check.vvpr == "Ja" %}{% ic %}Zijn de aandelen sinds creatie in kader van VVPRbis overgedragen aan andere aandeelhouders? {% input custom.check.overdracht as:select options:"Ja|Nee" %}{% endic %}{% endif %}
{% if custom.check.vvpr == "Ja" and custom.check.overdracht == "Nee" %}**VVPRbis**<br> Bij uitkering van dividenden aan natuurlijke personen kan u genieten van het verlaagd tarief van 15% vanaf het 4de boekjaar. 
{% elsif custom.check.vvpr == "Nee" or custom.check.overdracht == "Ja" %}{{ "VVPRbis is niet van toepassing. Wij bekijken graag met u de andere mogelijkheden." }}{% endif %}{% endif %}```

If the questions should always be the same in case of one or more natural shareholders, the best solution seems to generate a boolean variable which indicates whether the shareholders include at least one natural person.

Start your code with:

 {% assign nature_check = false %}

When we find a natural shareholder, we will set this variable to ‘true’.

Next, you should iterate over the shareholders using the period.shareholders drop:

{% for shareholder in period.shareholders %}
    {% if shareholder.custom.type == "nature" %}
        {% assign nature_check = true %}
    {% elsif shareholder.custom.represented_by_name == blank and shareholder.custom.type == blank %}
        {% assign nature_check = true %}
    {% endif %}
{% endfor %}

Depending on the nature_check boolean (true or false) you can determine which questions you would like to show!

Note that I suggested the elsif statement for cases in which can be assumed that the shareholder is natural, irrespective of the shareholder.custom.type value…

Hi Melle,

Can I do it also without the boolean, as we know what types of shareholders we have in “Bedrijfsparamaters”?

The boolean just tells whether you are having at least one natural person among your shareholders, and therefore whether the questions should apply.

In the Bedrijfsparameters there is no separate variable telling you whether there is at least one - only for each individual shareholder whether it is one.

Alternatively, you could count the natural persons among shareholders, and then show the questions when the count variable is one or more:

{% for shareholder in period.shareholders %}
    {% if shareholder.custom.type == "nature" %}
        {% assign nature_count = nature_count+1 %}
    {% elsif shareholder.custom.represented_by_name == blank and shareholder.custom.type == blank %}
        {% assign nature_count = nature_count+1 %}
    {% endif %}
{% endfor %}

After which the questions should depend on a statement like {% if nature_count >= 1 %}