CASE: how to display the right people (directors) depending on date of the mandats?

This is a common question in the workflow of Silverfin legal documents (text templates): how is Silverfin able to display the right directors, looking at the date of the meeting and if the directors are still in the company on that date (looking at date mandats for this)?

For instance:

I have 3 directors, with or without a begin- and enddate of their mandats:

If I’m making the report for the board of directors, held on 1/7/2018, then there’s 1 director that shouldn’t be mentionned as an option to choose him as president f.i. and that’s M. Jordan: on 1/7/2018 he’s no longer part of the organisation.

So how is Silverfin able to display the right option to choose a president f.i.?
21

Where is the needed data we are looking for?

It’s right in the period-drop, where all data is gathered regarding persons linked to the company. This is input or synced in the template “general company information” with this code:

{% stripnewlines %}
{% newline %}
|Name 
| {% if director_type == 'bestuurders' %}Executive director{% else %}Managing director{% endif %} 
| Shareholder 
| {% if director_type == 'bestuurders' %}Statutory{% else %}Statutory{% endif %} 
| Number of shares  
| Number of votes 
| Begin mandate 
| End mandaat 
{% newline %}
|----|----|----|----|----:|----:|---|----:+{% fori person in period.people %}
{% newline %}
| {% input person.name %}    
| {% nic %}{% if person.director == true %}x{% endif %}{% endnic %}{% input person.director as:boolean %} 
| {% nic %}{% if person.shareholder == true %}x{% endif %}{% endnic %}{% input person.shareholder as:boolean %} 
| {% nic %}{% if person.statutory == true %}x{% endif %}{% endnic %}{% input person.statutory as:boolean %} 
| {% input person.amount_of_shares as:integer %}  
| {% input person.amount_of_votes as:integer %}
| {% input person.director_start_date as:date %}  
| {% input person.director_end_date as:date %} 
{% newline %}
| {% input person.address_1 placeholder:'street+nbr' %}
{% newline %}
| {% input person.address_2 placeholder:'Postal code + city' %}{% ifi person.custom.represented_by_name != blank %}
{% newline %}
| {% input person.custom.represented_by_name placeholder:'Representant' %}{% endifi %}{% ifi person.custom.represented_by_vat != blank %}
{% newline %}
| {% input person.custom.represented_by_vat placeholder:'VAT-nbr' %}{% endifi %}
{% endfori %}
{% endstripnewlines %}

This code to be more precise, has the info of the beginning- and enddate of the mandats :

| {% input person.director_start_date as:date %}  
| {% input person.director_end_date as:date %}  

Create selection with the right options for president

In the report for the board of directors, you’ll find this code:

<!-- create "drop" (array) with ALL people to list as an option for president and/or secretary, and begin- and enddate mandats check with date RvB --> 

{% assign all_names = "" %}
{% assign all_keys = "" %}

{% for person in period.people %}
  {% assign show_begin_mandat = false %}
  {% assign show_end_mandat = false %}
  {% assign begin_mandat = person.director_start_date %}
  {% assign end_mandat = person.director_end_date %}
    {% if date_zkv >= begin_mandat or begin_mandat == blank %}
      {% assign show_begin_mandat = true %}
    {% endif %}
    {% if date_zkv <= end_mandat or end_mandat == blank %}
      {% assign show_end_mandat = true %}
    {% endif %}
      {% if show_begin_mandat and show_end_mandat %}
          {% assign all_names = all_names | append:person.name %}
        {% if person.custom.represented_by_name != blank %}
          {% assign all_names = all_names | append:" with permanent representative " | append:person.custom.represented_by_name %}
        {% endif %}
        {% unless forloop.last %}
          {% assign all_names = all_names | append:"|" %}
        {% endunless %}
          {% assign all_keys = all_keys | append:person.name.key %}
        {% unless forloop.last %}
          {% assign all_keys = all_keys | append:"|" %}
        {% endunless %}
      {% endif %}
{% endfor %}

{% assign zkv_all_names = all_names | split:"|" %}
{% assign zkv_all_keys = all_keys | split:"|" %}

Let’s dive into it :

{% assign all_names = "" %}

Here, we create a variable that’s blank. Later on, we’re gonna fill this up with data (this isn’t really needed though, but it’s a good habbit to assign a variable to nothing, if you are going to use it later on as an array (our needed selection).

{% for person in period.people %}

We loop right over all people in the period-drop, but we’re going to filter only the directors we need:

  {% assign show_begin_mandat = false %}
  {% assign show_end_mandat = false %}

We create 2 variables we’re going to use to display the right directors, if those variables are true (more on that later).
Because we use a variable in a loop, it’s important to put this on false for each loop. If you won’t do this, you can create an issue where the variable is true in the third loop. When you are in loop 4, that value stays on true, which shouldn’t be the case at all.

  {% assign begin_mandat = person.director_start_date %}
  {% assign end_mandat = person.director_end_date %}

Here we create 2 new variables, which are just the beginning date and end date of each director (each loop will have a different value then).

    {% if date_zkv >= begin_mandat or begin_mandat == blank %}
      {% assign show_begin_mandat = true %}
    {% endif %}
    {% if date_zkv <= end_mandat or end_mandat == blank %}
      {% assign show_end_mandat = true %}
    {% endif %}

Here, we assign the variables to true when the if-statement is fullfilled in each loop. This is very important because it will display our data we need in the for-loop!

      {% if show_begin_mandat and show_end_mandat %}
          {% assign all_names = all_names | append:person.name %}
      {% if person.custom.represented_by_name != blank %}
          {% assign all_names = all_names | append:" with permanent representative " | append:person.custom.represented_by_name %}
        {% endif %} 

With this code, we use the variable all_names and we fill it with the name of the person. Mind you, we only fill it when the if-statement is fullfilled: {% if show_begin_mandat and show_end_mandat %}
Furthermore, we even add the text " with permanent representative " and its value person.custom.represented_by_name to the variable when this if-statement is fullfilled: {% if person.custom.represented_by_name != blank %}

        {% unless forloop.last %}
          {% assign all_names = all_names | append:"|" %}
        {% endunless %} 

We add a pipe to our variable all_names unless if we are in the last loop. We do this so later on, we can split on that pipe (otherwise we would split one time too much).

Our variable all_names now has this value :
59

As addressed before, you can use this variable now as a as:select (because the as:select already splits on pipes):

{% input period.custom.board_directors.president_options as:select options:all_names %}

which will result in this :
31

1 Like

Above case is a bit of obsolete now; a better one can be found here: