Export details of all the shareholders, excluding Bare ownership

Hi everybody,

First time asking something on this community.

We have a problem with a report who shows all the shareholders, but I wan’t see/includes the “Bare ownership”. An idea how to change the following code?

I have already tried to simply remove the “Naakte eigendem”, “Nue-propriété” and “Bare owneship” but it seems not to be so easy…

{% assign shareholders = period.shareholders %}

{% assign show_suffix = false %}
{% assign total_shares = 0 %}
{% for shareholder in shareholders %}
{% if shareholder.custom.kind_of_shares == “Naakte eigendom” or shareholder.custom.kind_of_shares == “Nue-propriété” or shareholder.custom.kind_of_shares == “Bare ownership” or shareholder.custom.kind_of_shares == “Usufruct” or shareholder.custom.kind_of_shares == “Usufruit” or shareholder.custom.kind_of_shares == “Vruchtgebruik” %}
{% $0+ shareholder.amount_of_shares/2 %}
{% assign show_suffix = true %}
{% else %}
{% $0+ shareholder.amount_of_shares %}
{% endif %}
{% endfor %}

{% newpage %}



{::font size=‘s’}

{% unless hide_shareholders %}
{% stripnewlines %}
|—15%—|–20%–|–15%–|–18%–|–32%–+ {% newline %}
|   | Actionnaire | Nombre | Pourcentage | Adresse {% newline %}
{% for shareholder in shareholders limit:page_1_limit_shareholders %}{% assign shareholders_count_print = shareholders_count_print+1 %}
|
| {% if shareholder.custom.first_name != blank %}{{ shareholder.custom.first_name }} {{ shareholder.custom.last_name }}{% else %}{{ shareholder.name }}{% endif %}
| {{ shareholder.amount_of_shares | integer }}
{% if show_suffix %}
{% if shareholder.custom.kind_of_shares == “Naakte eigendom” %}NP{% endif %}
{% if shareholder.custom.kind_of_shares == “Nue-propriété” %}NP{% endif %}
{% if shareholder.custom.kind_of_shares == “Bare ownership” %}BO{% endif %}
{% if shareholder.custom.kind_of_shares == “Usufruct” or shareholder.custom.kind_of_shares == “Usufruit” %}UF{% endif %}
{% if shareholder.custom.kind_of_shares == “Vruchtgebruik” %}UF{% endif %}
{% if shareholder.custom.kind_of_shares == “Volle eigendom” %}PP{% endif %}
{% if shareholder.custom.kind_of_shares == “Pleine propriété” %}PP{% endif %}
{% if shareholder.custom.kind_of_shares == “Full ownership” %}FO{% endif %}
{% endif %}
| {{ shareholder.amount_of_shares/$0 | percentage }}
| {% if shareholder.custom.street != blank %}{{ shareholder.custom.street }} {{ shareholder.custom.street_number }}
{{ shareholder.custom.postal_code }} {{ shareholder.custom.city }}{% else %}{{ shareholder.address_1 }}
{{ shareholder.address_2 }}{% endif %}
{% newline %}
{% unless second_page %}
{% if forloop.last %}
|
|
|^{{ $0 | integer }}^
|^{{ $0/$0 | percentage }}^
{% endif %}
{% endunless %}
{% endfor %}
{% endstripnewlines %}
{% endunless %}
{:/font}


{::font size=‘s’}
{% if second_page %}
{% unless hide_shareholders %}
{% stripnewlines %}
|—15%—|–20%–|–15%–|–18%–|–32%–+ {% newline %}
|   | Actionnaire | Nombre | Pourcentage | Adresse {% newline %}
{% for shareholder in shareholders offset:shareholders_count_print limit:page_2_limit %}
|
| {% if shareholder.custom.first_name != blank %}{{ shareholder.custom.first_name }} {{ shareholder.custom.last_name }}{% else %}{{ shareholder.name }}{% endif %}
| {{ shareholder.amount_of_shares | integer }}
{% if show_suffix %}
{% if shareholder.custom.kind_of_shares == “Naakte eigendom” %}NP{% endif %}
{% if shareholder.custom.kind_of_shares == “Nue-propriété” %}NP{% endif %}
{% if shareholder.custom.kind_of_shares == “Bare ownership” %}BO{% endif %}
{% if shareholder.custom.kind_of_shares == “Usufruct” or shareholder.custom.kind_of_shares == “Usufruit” %}UF{% endif %}
{% if shareholder.custom.kind_of_shares == “Vruchtgebruik” %}UF{% endif %}
{% if shareholder.custom.kind_of_shares == “Volle eigendom” %}PP{% endif %}
{% if shareholder.custom.kind_of_shares == “Pleine propriété” %}PP{% endif %}
{% if shareholder.custom.kind_of_shares == “Full ownership” %}FO{% endif %}
{% endif %}
| {{ shareholder.amount_of_shares/$0 | percentage }}
| {% if shareholder.custom.street != blank %}{{ shareholder.custom.street }} {{ shareholder.custom.street_number }}
{{ shareholder.custom.postal_code }} {{ shareholder.custom.city }}{% else %}{{ shareholder.address_1 }}
{{ shareholder.address_2 }}{% endif %}
{% newline %}
{% if forloop.last %}
|
|
|^{{ $0 | integer }}^
|^{{ $0/$0 | percentage }}^
{% endif %}
{% endfor %}
{% endstripnewlines %}
{% endunless %}
{% endif %}
{:/font}

Thanks for your help!

Hi @Manu4008 ,

Welcome to our Community and thank you for your question :waving_hand: !

So just to confirm, you have a template that contains an overview of all shareholders. I copy pasted your code to my demo file and that seems to be working.

Now, do you want to exclude the shareholders that only have ‘bare ownership’ from the overview?

If so there are two ways of doing this, either we create a new array from the shareholders array where we do not include the shareholders with ‘bare ownership’ OR we exclude the rows where shareholder have ‘bare ownership’ when printing the table.

I can provide some code examples if that is what you are looking for :+1: . Just let me know!

Thank you!

Kind regards,
Robin

Hi Robin.

Thanks for welcoming :slightly_smiling_face:

You are right and have well understood what expected.

I think the best way to process will be to exclude “bare ownership”. I have already tried simply remove lines regarding this kind of shareholders but it didn’t work (too easy).

Thanks for helping me !

Hi @Manu4008 ,

Thank you for confirming our understanding.

I had a look at your code and made a few adjustments. I think if we change it like this it should work as expected:

{% assign shareholders = period.shareholders %}
{% assign shareholders_without_bare_ownership = "" | split:"|" %}

{% assign show_suffix = false %}
{% assign total_shares = 0 %}
{% for shareholder in shareholders %}
  {% if shareholder.custom.kind_of_shares == "Usufruct" or shareholder.custom.kind_of_shares == "Usufruit" or shareholder.custom.kind_of_shares == "Vruchtgebruik" %}
    {% $0+ shareholder.amount_of_shares/2 %}
    {% assign show_suffix = true %}
    {% push shareholder to:shareholders_without_bare_ownership %}
  {% elsif shareholder.custom.kind_of_shares == "Naakte eigendom" or shareholder.custom.kind_of_shares == "Nue-propriété" or shareholder.custom.kind_of_shares == "Bare ownership" %}
    {% comment %}Probably we don't want to take these into the sum?{% endcomment %}
  {% else %}
    {% $0+ shareholder.amount_of_shares %}
    {% push shareholder to:shareholders_without_bare_ownership %}
  {% endif %}
{% endfor %}

So first off, I created an elsif to exclude bare ownership share types from the total sum. Additionally, we create a new array shareholders_without_bare_ownership where we only add the shareholders that fall under the if or the else statement .

Finally, if we then replace for shareholder in shareholders with for shareholder in shareholders_without_bare_ownership where the tables are printed you will see tables that exclude the bare ownership type of shares.

Is this what you had in mind?

Kind regards,
Robin

1 Like