Colours titles in text modèle

Hello
We copied the Silverfin models to create our own models and want to color some titles. However, by color-setting the bold and underline text no longer work.

Thank you for your help,

Kind regards

Hi @THANAS,

Thanks for reaching out to Community. Did you try to put the markdown code for bold and underline outside of the HTML font color tags? E.g.

Code:

_**<font color='87CEE0'>Hi, this is an example</font>**_

Input view:

image

Some googling may help to find the correct hex code for the color you are looking for (‘87CEE0’ in my example).

Don’t hesitate to contact us again if this doesn’t work.

Hey @Melle,

Thank’s it’s works.

I have another question:

Below the code to choose a director, the name is reproduced in a text with {{custom.choosing.directors}} and I would like to have the gender and function also automatically reflected in the text. It is possible?

{% 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 %}

Hi @THANAS,

One solution would be to create two new arrays: ‘genders’ and ‘functions’, similar to the names and values array you are using already.

Before I can provide you with a more specific code suggestion, please elaborate on what you are trying to achieve with the code above? This might help us in finding the best solution for your problem.

Also, I can’t see where you are splitting your names and values arrays? This is required in case you want to iterate over an array.

Splitting is done as follows:

{% assign names = names | split:"|" %}

…in case you are using pipes as separators. Without splitting something like names[forloop.index0] will never work properly.

What we want to do is that by choosing a director at the top of the text template, information such as name, gender and function recopy in several places in our template.

If my code isn’t correct, don’t hesitate to change it.

Thank’s for your help

Hi Thanas

You might be able to solve this with help of the where attribute.
We have an example on our community: CASE: where attribute

When building arrays, you can also use the push tag in order to add items. This way you won’t have to add the pipe to that array. Push & Pop

Then you first have to create a variable where the first and last name of that person is combined before you add it to the names array.

Hey Robbe,

Sorry, I don’t see how to do with where attribute and Push & Pop.

Hi @THANAS

I have reworked your code a little bit to provide an example on how you can build your array.
In this example we also print the director_start_date of the chosen director.

{% assign director_name = "" %}
{% assign director_start_date = "" %}

{% assign names = "" | split:"" %}
{% assign values = "" | split:"" %}

{% for person in directors %}
  {% assign default_type = "" %}
  {% if person.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" %}
    {% push person.custom.represented_by_name to:names %}
    {% push person.id to:values %}
  {% else %}
    {% assign name = person.custom.first_name | append:" " | append:person.custom.last_name %}
    {% push name to:names %}
    {% push person.id to:values %}
  {% endif %}
  
    {% if person.id == custom.choosing.directors %}
    {% assign director_name = names[forloop.index0] %}
    {% assign director_start_date = person.director_start_date %}
  {% endif %}
  
{% endfor %}

{% assign director_names = names | join:"|" %}
{% assign director_values = values | join:"|" %}

{% input custom.choosing.directors as:select options:director_names option_values:director_values %}

{{ director_name }}
{{ director_start_date | date:"%d/%m/%Y" }}

Hey @Robbe_Dewilde,

Unfortunately it doesn’t work. I don’t know select a director.

I want to select a director and the name, gender and function appears in my text. In your code, I can just select a director, why my code isn’t good?

Thank’s for your help,

Hi @THANAS

Can you show me the exact code you are using for this?

hey @Robbe_Dewilde,

Here is the code I want when I select the director, the name and function appears in my text (actually is a dropdown for the function) and also the gender remplace the dropdown.

Thank’s a lot,

{% 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 %}



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

Par la présente, {% input custom.title.dropdown as:select options:"Monsieur|Madame" %} {{custom.choosing.directors}}, {% input custom.functiondirectors.dropdown as:select options:"Administrateur|Administrateur-délégué" %} de la société sous rubrique déclare avoir pris connaissance et possession des documents repris ci-après

Hi @THANAS,

If you would like to have the function displayed instead of the dropdown it is possible to just print
{{ person.custom.function_title }}

If you would like this to be the default of the drop down you can use person.custom.function_title as the default option in the dropdown.

If you would like a more detailed example please let us know in more detail what the exact function is you would like to achieve. Unfortunately it is not possible to do this with gender as we do not have a sync with this data.

hi @Maxim_Wittesaele,

Can you send me the code because I don’t quite understand it.

I want to have a dropdown for select the director (like my code above).

After selecting it, the name and function appear in a predefined text (with {{custom.choosing.directors}}, etc…).

For the gender, it is possible with person.custom.gender like in Silverfin template “Procès-verbal de la réunion de l’organe d’administration/du (des) gérant(s)”

Thank’s a lot for your help,

Hi @THANAS,

Sorry for the slow response,

Hereby a solution that should work. Please keep in mind that the gender only works in french and comes from Coordonnées de l’entreprise and person.function.function_title comes from the sync.

{% assign directors = period.directors %}{% assign names = “” %}
{% assign values = “” %}
{% assign gender = “” %}
{% assign function = “” %}
{% for person in directors %}
{% assign gender = gender | append:person.custom.gender | append:"|" %}
{% assign function = function | append:person.custom.function _title | append:"|" %}
{% 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%}
{% assign def_gender = person.custom.gender %}
{% assign def_role = person.custom.function_title %}
{% endif%}
{% endfor %}

A l’attention de {% input custom.choosing.directors as:select options:names %}{% newline %}Par la présente, {% input custom.title.dropdown as:select options:“Monsieur|Madame” option_values:gender default:def_gender %} {{custom.choosing.directors}}, {% input custom.functiondirectors.dropdown as:select options:“Administrateur|Administrateur-délégué” option_values:function default:def_role %} de la société sous rubrique déclare avoir pris connaissance et possession des documents repris ci-après

hi @Maxim_Wittesaele,

This is the result I want to have, I select a director and the text appear (Mister/name/function)

with the above code, it doesn’t work…

Thank’s a lot

image

Hi @THANAS

I’ve re-worked this code snippet using the push tag and where filter suggested by @Robbe_Dewilde here above.

Instead of using a new database variable for the gender & function, I’ve used the same ones as in “Coordonnées de l’entreprise”. This way if a gender or function for a director is added/changed here, this will also be linked to the other legal texts.

{% t= "t_represented_by" default:"with permanent representative" nl:"vertegenwoordigd door" fr:"représentée par son représentant permanent" %}
{% capture t_represented_by %} {% t "t_represented_by" %} {% endcapture %}

{% assign director_options = "" | split:"|" %}
{% assign director_values = "" | split:"|" %}

{% assign directors = period.directors %}

{% 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 %} 
  {% assign begin_mandate = person.director_start_date | date:"%Y-%m-%d" %}
  {% assign end_mandate = person.director_end_date | date:"%Y-%m-%d" %}
  
  {% comment %}Determine if the person is a natural person & has a valid mandate{% endcomment %}
  {% assign eligible = false %}
  
  {% if person.statutory == true %}
    {% assign eligible = true %}
  {% else %}
    {% comment %}Show director if dates GM or begin/end mandate are valid/blank{% endcomment %}
    {% assign eligible = true %}
    
    {% if date_av != blank %}
      {% if begin_mandate != blank and begin_mandate > date_av %}
        {% assign eligible = false %}
      {% endif %}
      
      {% if end_mandate != blank and end_mandate < date_av %}
        {% assign eligible = false %}
      {% endif %}
    {% endif %}
  {% endif %}

  {% comment %}Only add the director to the options & assign the data if he/she is eligible{% endcomment %}
  {% if eligible %}
    {% assign words = person.name | split: ' ' %}
    {% assign def_person_last_name = "" %}
    {% assign def_person_first_name = "" %}
    {% for word in words %}
      {% if forloop.last %}
        {% assign def_person_first_name = word %}
      {% else %}
        {% assign def_person_last_name = def_person_last_name | append:" " | append:word %}
      {% endif %}
    {% endfor %}
    {% assign person_first_name = person.custom.first_name | default:def_person_first_name %}
    {% assign person_last_name = person.custom.last_name | default:def_person_last_name %}
    
    {% if type == "legal" %}
      {% if person.statutory == true or person.director == true %}
        {% capture director_name %}{{ person.name }}{{ t_represented_by }}{{ person.custom.represented_by_name }}{% endcapture %}
      {% endif %}
    {% else %}
      {% if person.statutory == true or person.director == true %}
        {% capture director_name %}{{ person_first_name }} {{ person_last_name }}{% endcapture %}
      {% endif %}
    {% endif %}
    
    {% comment %}Use the persistent_id so this can be rollforwarded{% endcomment %}
    {% assign director_id = person.persistent_id %}
    
    {% comment %}Add the director to the select options{% endcomment %}
    {% push director_name to:director_options %}
    {% push director_id to:director_values %}
  {% endif %}
  
  {% capture stored_director_name %}name_{{ director_id }}{% endcapture %}
  {% assign [stored_director_name] = director_name %}

{% endfor %}

{% comment %}Contains the names of the directors{% endcomment %}
{% assign director_options = director_options | join:"|" %}
{% comment %}Contains the persistent_ids of the directors{% endcomment %}
{% assign director_values = director_values | join:"|" %}

{% assign selected_director_id = custom.choosing.directors %}
{% assign selected_director = directors | where:"persistent_id",director_id | first %}
{% assign selected_gender = "" %}
{% assign selected_function = "" %}

{% comment %}Get the name of the selected director{% endcomment %}
{% capture stored_director_name %}name_{{ selected_director_id }}{% endcapture %}

{% comment %}(13 = Administrateur / 14 = Administrateur-délégué) --> numbers are the XBRL values for these functions{% endcomment %}
{% assign function_values = "13|14" %}
{% comment %}Generic values for the dropdown to support translations if necessary{% endcomment %}
{% assign gender_values = "man|woman" %}

A l’attention de {% input custom.choosing.directors as:select options:director_options option_values:director_values %}

{% if custom.choosing.directors != blank %}

{% assign selected_gender = selected_director.custom.gender %}
{% assign selected_function = selected_director.custom.function %}

{% stripnewlines %}

Par la présente, {% input selected_director.custom.gender as:select options:"Monsieur|Madame" option_values:gender_values %}
&nbsp;{{ [stored_director_name] }},
{% comment %}Use a dropdown if the user can select values to support translations or print selected_director.custom.function_title for fixed text{% endcomment %}
&nbsp;{% input selected_director.custom.function as:select options:"Administrateur|Administrateur-délégué" option_values:function_values %}
&nbsp;de la société sous rubrique déclare avoir pris connaissance et possession des documents repris ci-après

{% endstripnewlines %}

{% endif %}

{% ic %}

| selected_director: {{ selected_director_id }}
| gender: {{ selected_gender }}
| function: {{ selected_function }}

{% endic %}

Could you check and let us know if this is now working as expected?

hi @Wouter_Bruynsteen ,

That’s fine, but that’s not exactly what I want in the end. Maybe I don’t explain very well what I want to get.
In the final version, it must have only one choice of administrator and the rest is automatically copied ( “Monsieur/madame”; name; function).

Our models are only in French. Here it is only an extract, we will create longer templates and we wish that from a choice of administrator the text fits correctly throughout the model.

In my previous screenshot, the choice of administrator is at the level of the "à l’attention de … " and then the text below, is automatically completed by indicating “Monsieur” or “Madame” depending on the gender, the name of the administrator and its function based on the information in the “coordonnées d’entreprise”.

Hi @THANAS,

I made some small changes to the code. Now the function of the director should come from the ‘General company details’ directly (no dropdown) and associate the gender to each of the directors. You would probably need still to make some more tweaks to get it to work exactly how you expect (for example, how do you want to show the function title, remember we have this stored as numbers 13 o 14, or move the dropdown to assign the gender to somewhere outside the text).

At the bottom of the code there is an overview, provided originally by Wouter with his code, with the variables created, and those are the ones you can use from now on to avoid having to select again the parameters every time. But still, you will need to select in first place the director name and it’s gender once.

Here is the code, I hope it closer to what you want to accomplish:

{% t= "t_represented_by" default:"with permanent representative" nl:"vertegenwoordigd door" fr:"représentée par son représentant permanent" %}
{% capture t_represented_by %} {% t "t_represented_by" %} {% endcapture %}

{% assign director_options = "" | split:";" %}
{% assign director_values = "" | split:";" %}
{% assign director_functions = "" | split:";" %}

{% assign directors = period.directors %}

{% 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 %} 
  {% assign begin_mandate = person.director_start_date | date:"%Y-%m-%d" %}
  {% assign end_mandate = person.director_end_date | date:"%Y-%m-%d" %}
  
  {% comment %}Determine if the person is a natural person & has a valid mandate{% endcomment %}
  {% assign eligible = false %}
  
  {% if person.statutory == true %}
    {% assign eligible = true %}
  {% else %}
    {% comment %}Show director if dates GM or begin/end mandate are valid/blank{% endcomment %}
    {% assign eligible = true %}
    
    {% if date_av != blank %}
      {% if begin_mandate != blank and begin_mandate > date_av %}
        {% assign eligible = false %}
      {% endif %}
      
      {% if end_mandate != blank and end_mandate < date_av %}
        {% assign eligible = false %}
      {% endif %}
    {% endif %}
  {% endif %}

  {% comment %}Only add the director to the options & assign the data if he/she is eligible{% endcomment %}
  {% if eligible %}
    {% assign words = person.name | split: ' ' %}
    {% assign def_person_last_name = "" %}
    {% assign def_person_first_name = "" %}
    {% for word in words %}
      {% if forloop.last %}
        {% assign def_person_first_name = word %}
      {% else %}
        {% assign def_person_last_name = def_person_last_name | append:" " | append:word %}
      {% endif %}
    {% endfor %}
    {% assign person_first_name = person.custom.first_name | default:def_person_first_name %}
    {% assign person_last_name = person.custom.last_name | default:def_person_last_name %}
    
    {% if type == "legal" %}
      {% if person.statutory == true or person.director == true %}
        {% capture director_name %}{{ person.name }}{{ t_represented_by }}{{ person.custom.represented_by_name }}{% endcapture %}
      {% endif %}
    {% else %}
      {% if person.statutory == true or person.director == true %}
        {% capture director_name %}{{ person_first_name }} {{ person_last_name }}{% endcapture %}
      {% endif %}
    {% endif %}
    
    {% comment %}Use Director Function from General Parameters Doc{% endcomment %}
    {% if person.custom.function != blank %}
      {% push person.custom.function to:director_functions %}
    {% else %}
      {% push "13" to:director_functions %}
    {% endif %}
    
    {% comment %}Use the persistent_id so this can be rollforwarded{% endcomment %}
    {% assign director_id = person.persistent_id %}
    
    {% comment %}Add the director to the select options{% endcomment %}
    {% push director_name to:director_options %}
    {% push director_id to:director_values %}
  {% endif %}
  
  {% capture stored_director_name %}name_{{ director_id }}{% endcapture %}
  {% assign [stored_director_name] = director_name %}

{% endfor %}

{% assign selected_director_id = custom.choosing.directors %}
{% assign selected_director = directors | where:"persistent_id",director_id | first %}
{% assign selected_gender = "" %}
{% assign selected_function = "" %}

{% comment %}Get the name of the selected director{% endcomment %}
{% capture stored_director_name %}name_{{ selected_director_id }}{% endcapture %}
{% assign selected_director_name = [stored_director_name] %}

{% comment %}Get the function for the director from "General Company Data"{% endcomment %}
{% for director_id in director_values %}
  {% capture director_id %}{{ director_id }}{% endcapture %}
  {% capture selected_director_id %}{{ selected_director_id }}{% endcapture %}
  {% if director_id == selected_director_id %}
    {% assign selected_function = director_functions[forloop.index0] %}
  {% endif %}
{% endfor %}
{% comment %}Gender{% endcomment %}
{% assign selected_gender = custom.[selected_director_id].gender %}

{% comment %}Contains the names of the directors{% endcomment %}
{% assign director_options = director_options | join:"|" %}
{% comment %}Contains the persistent_ids of the directors{% endcomment %}
{% assign director_values = director_values | join:"|" %}

{% comment %}Generic values for the dropdown to support translations if necessary{% endcomment %}
{% assign gender_values = "man|woman" %}

A l’attention de {% input custom.choosing.directors as:select options:director_options option_values:director_values %}

{% if custom.choosing.directors != blank %}

{% stripnewlines %}

Par la présente, {% input custom.[selected_director_id].gender as:select options:"Monsieur|Madame" option_values:gender_values %}
&nbsp;{{ selected_director_name }},
{% comment %}(13 = Administrateur / 14 = Administrateur-délégué) --> numbers are the XBRL values for these functions{% endcomment %}
&nbsp;{% if selected_function == 14 %}Administrateur-délégué{% else %}Administrateur{% endif %}
&nbsp;de la société sous rubrique déclare avoir pris connaissance et possession des documents repris ci-après

{% endstripnewlines %}

{% endif %}

{% ic %}
  OVERVIEW
| selected_director: {{ selected_director_id }}
| selected_director_name: {{ selected_director_name }}
| selected_gender: {{ selected_gender }}
| selected_function: {{ selected_function }}

{% endic %}

Hello @agustin ,

It works, thank you! Can you just tell me what the " &nbsp " and where I can find the “XBRL Values”?

Thanks again,

Kind Regards