Infotext text-template

hello, i’m new to code and i’m having a little trouble with alignments. See the code below, I would like to see classify 3 checks next to each other. Is it possible that when we select a check a predefined paragraph is added in the text?

“”"{% ic %}
{::infotext}
{% stripnewlines %}

----:

{% newline %}
| Test 1
| {% input custom.test1.advance as:boolean %}
{% newline %}
| Test 2
| {% input custom.test2.advance as:boolean %}
{% newline %}
| Test 3
| {% input custom.test3.advance as:boolean %}
{% newline %}
| Test 4
| {% input custom.test4.advance as:boolean %}
{% newline %}
| Test 5
| {% input custom.test5.advance as:boolean %}
{% newline %}
| Test 6
| {% input custom.test6.advance as:boolean %}

{% endstripnewlines %}
{:/infotext}
{% endic %} “”"

Hi @THANAS

Thank you for your question!

To show text based on the condition that the checkbox is ticked, you could use an IF-statement, for instance:

{% if custom.test1.advance == true %}Your text{% endif %}

To structure your content, you have to change the table definition (dashes and pipes under the stripnewlines tag). This is where we indicate the amount of columns our table needs to have. Below I added a simple variation of your code to illustrate how this works:

3 tests per row:

{% ic %}
{::infotext}
{% stripnewlines %}
|----|----|----|----|----|----
{% newline %}
| Test 1
| {% input custom.test1.advance as:boolean %}
| Test 2
| {% input custom.test2.advance as:boolean %}
| Test 3
| {% input custom.test3.advance as:boolean %}
{% newline %}
| Test 4
| {% input custom.test4.advance as:boolean %}
| Test 5
| {% input custom.test5.advance as:boolean %}
| Test 6
| {% input custom.test6.advance as:boolean %}
{% newline %}
{% endstripnewlines %}
{:/infotext}
{% endic %}

I hope this was helpful to you and wish you success with coding!

Many thanks for your response, that’s exactly what I wanted. I added another piece of code to make the text editable, what do you think? is it correct?

‘’’{% if custom.test1.advance == true %}{% input custom.value_dropdown.text1 default:“Your Text1” %}{% endif %}’’’

I also made a list that I want to make editable like the code above but if one of the points is not needed I can remove it and the numbering of my list is correct. Is it possible ?

Hi @THANAS,

It sure is possible. Simply create a variable that always adds up if the condition of the IF-statement is true:

{% comment %}some needed variables to use in text{% endcomment %}
{% assign section_nbr = 0 %}

{% comment %}calculate section number{% endcomment %}
{% if custom.show_txt.section_a %}
  {% assign section_nbr = section_nbr | plus:1 %}
{% endif %}

**{{ section_nbr }}** Some title

{% input custom.show_txt.section_a as:boolean %} {% input custom.section_a.txt as:text %} 

You might want to check this case as well, while you’re creating your own text templates :wink:

Hello @sven,

Is it possible to check in my template because when exporting the layout does not match

you can contact me by email

thank’s

Hi @THANAS

Could you share (a snippet of) your code please so we could look into it and specify what exactly the issue is you’re having when exporting?

Kind regards
Wouter

Hi @THANAS

In order for us to advise, you’ll have to be a bit more specific as to what your actual issue is.
What is the output that you want? What is wrong with the export you’re referring to?

Sidenote: please share your code wrapped in ``` for optimal readability (you’re using ‘’’ which doesn’t work).

Best regards,
Simon

hey @simon_vds,

It’s ok now, I have just one other question.

I want to be able to choose the directors, I use {{ period.directors. }} but when the director is a legal entity I would like to have the name of the representative . Is this possible?

Best regards,

hi @THANAS

yes, please see the code below to get the representatives of the legal entity directors:

{% for director in period.people %}
  {{ director.custom.represented_by_name }}
{% endfor %}

Best regards,
Simon

Hey @simon_vds,

What I would like to have is a choice between the different directors and when they are legal entities that the name of the representative appears instead of the name of the company.

I would also like to have the function in the company that is listed in the company details.

Thank you,

Best regards,

Hi @THANAS

Here is some explanation and code to guide you:

you want to choose between the different directors, therefor look into the database = period.directors
Further, you want that the legal entities show ‘represented by’ after the entities name, therefor you distinguish between the type - legal or nature . Only legal entities have a person.custom.represented_by_name != blank

When the type is legal => you show the person.name , represented by , person.custom.represented_by_name and store it into names

To make every option of the dropdown unique, store the person.id into values

Now, you have created the dropdown to choose between directors : {% input custom.choosing.directors as:select options:names option_values:values %}

{% 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.name | append:" represented by " | 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 %}
{% endfor %}

{% ic %}{::infotext}
Choose director: {% input custom.choosing.directors as:select options:names option_values:values %} 
{:/infotext}{% endic %}

You can apply the same logic to show the function in person.custom.function, however here you should be aware that the function is stored as a number as follow :

{% case person.custom.function %}
      {% when 10 %}{% assign person_function = "Voorzitter van de Raad van Bestuur" %}
      {% when 11 %}{% assign person_function = "Ondervoorzitter van de Raad van Bestuur" %}
      {% when 13 %}{% assign person_function = "Bestuurder" %}
      {% when 14 %}{% assign person_function = "Gedelegeerd bestuurder" %}
      {% when 20 %}{% assign person_function = "Bestuurder-zaakvoerder" %}
      {% when 30 %}{% assign person_function = "Zaakvoerder" %}
      {% when 40 %}{% assign person_function = "Vennoot" %}
      {% when 60 %}{% assign person_function = "Voorzitter van de Raad van Commissarissen" %}
      {% when 61 %}{% assign person_function = "Commissaris" %}
      {% when 63 %}{% assign person_function = "Regeringscommissaris" %}
      {% when 70 %}{% assign person_function = "Externe accountant" %}
      {% when 71 %}{% assign person_function = "Bedrijfsrevisor" %}
      {% when 80 %}{% assign person_function = "Vereffenaar" %}
      {% when 81 %}{% assign person_function = "Curator" %}
      {% when 72 %}{% assign person_function = "Erkende boekhouder" %}
      {% when 73 %}{% assign person_function = "Erkende boekhouder-fiscalist" %}
      {% endcase %} 

I hope this helps you further!
Happy holidays

Sofie

hey @Sofie_Cleemput1,

Thank’s a lot.

This works perfectly, however when I take “custom.choosing.directors” and add it at different places in my text to avoid having to choose each time, I don’t get the name but a number.

Thank you for your help,

best regards

Hi @THANAS,

When you print custom.choosing.directors in any place in your code, this will show the selected option value instead of the selected option indeed. If you want to make the option (i.e. names in this case) visible you should to the following:

{% assign names = names | split:’|’ %}
{% for person in directors %}
{% assign forloop_index = forloop.index0 %}
{% if person.id == custom.choosing.directors %}{{ names[forloop_index] }}{% endif %}
{% endfor %}

You need to loop through the period.directors again and identify which one you have selected in the dropdown. This exact one will be in the same position in the names array.

Hope this is clear!

Kind regards,
Robin