# Choose an administrator

**URL:** <https://community.silverfin.com/t/choose-an-administrator/2394>\
**Category:** Templates\
**Created:** [January 28, 2023, 1:13pm UTC](https://community.silverfin.com/t/choose-an-administrator/2394 "2023-01-28T13:13:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![THANAS](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@THANAS](https://community.silverfin.com/u/THANAS)\
**Post date:** [January 28, 2023, 1:13pm UTC](https://community.silverfin.com/t/choose-an-administrator/2394/1 "2023-01-28T13:13:29Z")

</div>

Hello, I was using this code to select directors or permanent representatives of companies. Can someone help me to adapt it with the new reconciliation “Legal Report - Shareholders/Associates & Managers / the Board of Directors”?

I would also like to be able to put “Mr./Ms.” according to gender.

Thank you for your help.

Sincerely

```auto
{% assign directors = period.directors %}

{% assign names = "" %}
{% assign values = "" %}
{% for person in directors %}
  {% assign default_type = "" %}
  {% if person.custom.represented_by_name != blank %}
    {% assign default_type = "legal" %}
  {% else %}
    {% assign default_type = "nature" %}
  {% endif %}
  {% assign type = person.custom.type | default:default_type %} 
  {% if type == "legal" %}
    {% assign names = names | append:person.custom.represented_by_name %}
    {% assign values = values | append:person.id %} 
  {% else %}
    {% assign names = names | append:person.custom.first_name | append:" " | append:person.custom.last_name %} 
    {% assign values = values | append:person.id %} 
  {% endif %}
  {% unless forloop.last %}
    {% assign names = names | append:"|" %}
    {% assign values = values | append:"|" %}
  {% endunless %}
    {% assign forloop_index = forloop.index0%}
  {% if person.id == custom.choosing.directors%}{{ names [forloop_index] }} {% endif%}
{% endfor %}

<br>
<br>

 {{ company.name }} {{ company.company_form }} 
 A l’attention de {% input custom.choosing.directors as:select options:names %}

```

---

<div class="post-metadata">

**Author:** ![Romy\_Vermeeren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/romy_vermeeren/32/2295_2.png) [@Romy\_Vermeeren](https://community.silverfin.com/u/Romy_Vermeeren)\
**Post date:** [January 30, 2023, 8:40am UTC](https://community.silverfin.com/t/choose-an-administrator/2394/2 "2023-01-30T08:40:21Z")

</div>

Hi @THANAS

If your code worked before, that should still be the case. All these fields still have the same name in the database.

As for the gender, you can add it in front of the name, but this changes the options and will break the existing input. The code actually mentions “values”, this was intended to use as option\_values, by using `option_values` you can change the `options` without breaking the input.

So as not to break you current input, you would need to use the current options (names) as option\_values, and then create new options with the genders attached.  
I’ve taken the liberty to also add a basic translation, but this is not necessary if you would only use 1 language.

```auto
{% assign directors = period.directors %}

{% t= "Mr" fr:"Monsieur" %}
{% t= "Mrs" fr:"Madame" %}

{% assign names_values = "" %}
{% assign names_options = "" %}
{% assign values = "" %}
{% for person in directors %}
  {% assign default_type = "" %}
  {% if person.custom.represented_by_name != blank %}
    {% assign default_type = "legal" %}
  {% else %}
    {% assign default_type = "nature" %}
  {% endif %}
  {% assign type = person.custom.type | default:default_type %} 
  {% comment %}Gender is stored as "man" or "woman", add some logic to convert it{% endcomment %}
  {% assign gender = person.custom.applicable_gender %}
  {% if gender == "man" %}
    {% capture gender_address %}{% t "Mr" %} {% endcapture %}
  {% elsif gender == "woman" %}
    {% capture gender_address %}{% t "Mrs" %} {% endcapture %}
  {% else %}
    {% assign gender_address = "" %}
  {% endif %}
  {% if type == "legal" %}
    {% assign names_values = names_values| append:person.custom.represented_by_name %}
    {% assign values = values | append:person.persistent_id %} 
    {% assign names_options = names_options | append:gender_address| append:person.custom.represented_by_name %}
  {% else %}
    {% assign names_values = names_values| append:person.custom.first_name | append:" " | append:person.custom.last_name %} 
    {% assign values = values | append:person.persistent_id %} 
    {% assign names_options = names_options | append:gender_address | append:" " | append:person.custom.first_name | append:" " | append:person.custom.last_name %}
  {% endif %}
  {% unless forloop.last %}
    {% assign names_values = names_values | append:"|" %}
    {% assign values = values | append:"|" %}
    {% assign names_options = names_options | append:"|" %}
  {% endunless %}
    {% assign forloop_index = forloop.index0%}
  {% if person.persistent_id == custom.choosing.directors%}{{ names_options [forloop_index] }} {% endif%}
{% endfor %}

<br>
<br>

 {{ company.name }} {{ company.company_form }} 
 A l’attention de {% input custom.choosing.directors as:select options:names_options option_values:names_values %}

```

You may notice I also replaced persion.id with person.`persistent_id.`  
This is just a good practice, as the id changes every period, while persistent\_id remains the same.  
(as the name implies 😉 )

Hope this helps,  
Kind regards,

Romy

---

<div class="post-metadata">

**Author:** ![THANAS](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@THANAS](https://community.silverfin.com/u/THANAS)\
**Post date:** [January 30, 2023, 10:13am UTC](https://community.silverfin.com/t/choose-an-administrator/2394/3 "2023-01-30T10:13:07Z")

</div>

Hi @Romy_Vermeeren,

Many thanks for your help.

I thought that with the change in reconciliation it would have changed the links.

It’s a regret that we don’t have the gender for the permanent representative (this is a request I made to support)

Is it also possible to take over the function of the administrator?

Kind regards,

---

<div class="post-metadata">

**Author:** ![Romy\_Vermeeren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/romy_vermeeren/32/2295_2.png) [@Romy\_Vermeeren](https://community.silverfin.com/u/Romy_Vermeeren)\
**Post date:** [January 30, 2023, 12:25pm UTC](https://community.silverfin.com/t/choose-an-administrator/2394/4 "2023-01-30T12:25:48Z")

</div>

Hi @THANAS

No worries, we’re happy to help.  
The main difference you’ll notice code-wise with the new templates, is that you can now access results from them. (you can find an overview [here](https://community.silverfin.com/c/silverfin-templates/results/42)!)

The code for this template is open source, so if you open the reconciliation text on the “template tab” in your Silverfin environment, you can find the name of any input. Function is `person.custom.function`, but note that it has a default value as well, which isn’t stored in the database. You’d have to repeat the logic that was used to come to this default.

Kind regards,  
Romy
