Custom text "info blad"

Hi,

We are having a problem with a custom text document: “info blad”
We are trying to give an overview of shareholers and directors but we ar strugling with the kind of shares.
Code

**Overzicht van de aandeelhouders**
{% stripnewlines %}
{% newline %}
|**Aandeelhouders**
|**Aantal aandelen**
|**Met stemrecht**{% ic %}{::infotext as="hover"}Deze data wordt opgehaald uit de bedrijfsparameters{:/infotext}{% endic %}
|**Eigendom**
|**Klasse**
|**Stemrechten t.o.v. totaal**
{% newline %}
|---
|---:
|---:
|---:
|---:
|---:{% ic %}#{% endic %}{% nic %}+{% endnic %}{% for shareholder in period.shareholders %}
{% assign words = shareholder.name | split: ' ' %}
  {% assign lastname = "" %}
  {% assign person_first_name = "" %}
  {% assign current_signature = "" %}
  {% for word in words %}
    {% if forloop.last %} {% comment %}correct for syncs like adminis{% endcomment %}
      {% assign person_first_name = word %}
    {% else %}
      {% assign lastname = lastname | append:" " | append:word %}
    {% endif %}
  {% endfor %}
{% if shareholder.custom.represented_by_vat != blank %}
  {% assign default_type ="legal" %}
{% else %}
  {% assign default_type ="nature" %}
{% endif %}
{% comment %}create local var to indicate whether or not a legal person is selected{% endcomment %}
{% assign type_person = shareholder.custom.type | default:default_type %}
{% newline %}
{% if shareholder.custom.first_name == blank and shareholder.custom.last_name == blank %}
      {% assign current_signature = shareholder.name %}
    {% elsif shareholder.custom.first_name == blank and shareholder.custom.last_name != blank %}
      {% assign current_signature = shareholder.name %}
    {% elsif shareholder.custom.first_name != blank and shareholder.custom.last_name == blank %}
      {% assign current_signature = shareholder.name %}
    {% else %}
      {% assign current_signature = current_signature | append:shareholder.custom.first_name | append:" " | append:shareholder.custom.last_name %}
    {% endif %} 
|{{ current_signature }}
|{{ shareholder.amount_of_shares | integer }}
|{{ shareholder.amount_of_votes | integer }}
|{{ shareholder.custom.kind_of_shares }}
|{{ shareholder.custom.shares_classes }}
|{% $2+ shareholder.amount_of_votes/$1 %}{{ shareholder.amount_of_votes/$1 | percentage }}
{% endfor %}
{% newline %}
|**Totaal aantal aandelen**
|**{{ $0 | integer }}**
|**{{ $1 | integer }}**
|
|
|**{{ $2 | percentage }}**
{% endstripnewlines %}

output

the value in |{{ shareholder.custom.kind_of_shares }} doesn’t contain any value

however if we overwrite the dropdown in “bedrijfsparameters”
image
then |{{ shareholder.custom.kind_of_shares }} has a value.

At first, it seemed like a caching issue. We got this anwer via support:

The issue here is that the custom template is not supporting the default value coming from the sync for the ‘Eigendom’ field.

The custom template only displays person.custom.kind_of_shares, but the company parameters also check if there’s a stock type available from the sync in person.custom.stock_type.

See below for the code snippet we use to map the sync value to this dropdown in the ‘Bedrijfsparameters’:
| **{% t "Aard aandelen" %}** {% assign stock_type_from_sync = person.custom.stock_type %} {% assign def_stock_type = "" %} {% case stock_type_from_sync %} {% when 1 %} {% assign def_stock_type = "Volle eigendom" %} {% when 2 %} {% assign def_stock_type = "Naakte eigendom" %} {% when 3 %} {% assign def_stock_type = "Vruchtgebruik" %} {% when 4 %} {% assign def_stock_type = "Onverdeeldheid" %} {% endcase %} | {% input person.custom.kind_of_shares as:select default:def_stock_type options:"Volle eigendom|Naakte eigendom|Vruchtgebruik|Onverdeeldheid" %}

but I don’t really know how to implement this in our custom text. maybe because it’s fridayafternoon, i don’t know :slight_smile:

Can anyone help me with this?
Thanks!

Hi @AlexanderDB,

Instead of just printing {{ shareholder.custom.kind_of_shares }} you will also have to take into account the default value def_stock_type that contains the value from the sync and is added to that input field in the company parameters.

Here’s a step by step of how you can implement that in your code.

You will first want to assign the default value which contains the sync value:

{% assign stock_type_from_sync = shareholder.custom.stock_type %} 
{% assign def_stock_type = "" %} 
{% case stock_type_from_sync %} 
{% when 1 %} {% assign def_stock_type = "Volle eigendom" %} 
{% when 2 %} {% assign def_stock_type = "Naakte eigendom" %} 
{% when 3 %} {% assign def_stock_type = "Vruchtgebruik" %} 
{% when 4 %} {% assign def_stock_type = "Onverdeeldheid" %} 
{% endcase %}

Then you can create a local variable, I called it kind_of_shares here that not only looks at the input field but also takes into account the default value from the sync.

{% assign kind_of_shares = shareholder.custom.kind_of_shares | default:def_stock_type %}

And then you can print this:

|{{ kind_of_shares }}

Hope this clarifies it for you.

Kind regards,
Kimberly

Hi @Kimberly_Vlietinck ,

thanks! This works fine.
first we thought it was some kind of caching issue.