Person.name (first first name and then last name)

Hello,

I want to show a list of all directors, I use a for loop “director” and to have the name I use the tag {{ director.name }}
If the director is a natural person, it shows up with the last name first and then the first name.

I would like to have the first name at the first position and then the last name

@Tanguy,

Thanks for reaching out to Community. I have to make a couple of assumptions before I can answer your question, which are: 1) you are using the BE company info template, and 2) you have entered the first- and last name of the director in the respective fields in that template.

In this case, you could use person.custom.first_name and person.custom.last_name in order to get the first and last name of the director separately.

To be sure not to miss any person you entered in the company info template, iterate over period.people instead of period.directors (if you are not already doing that) and then check for each consecutive person {% if person.director %}:

{% for person in period.people %}
    {% if person.director %}
       {{ person.custom.first_name }} {{ person.custom.last_name }}
    {% endif %}
{% endfor %}

Does this help?

But in the list there are also legale person

{% for person in period.people %}
    {% if person.director and person.custom.type == 'nature' %}
       {{ person.custom.first_name }} {{ person.custom.last_name }}
    {% endif %}
{% endfor %}

Important note: make sure that in the company info, the ‘type’ dropdown has been correctly selected and is not set on its default value.

It might also be an option to contact support via support@silverfin.com, where you can provide the link to your live environment so we can help you with checking what the problem exactly is.

ok thank you

Hi @Tanguy ,

Allow me to jump in here real quick with some additional feedback: the value of .name is (in your case) probably the value that is synced, correct?

Well, keep in mind that it depends from sync to sync how that value is synced to Silverfin:

  • sync A can give the name as Jordan Michael
  • sync B can give the name as Michael Jordan

What I’m trying to say, is in Liquid logic there’s no way to know for 100% sure how that name is formatted (as you cannot access which type of sync is being used).

This is the reason why you’ll see this code in our BE templates:

    {% assign words = person.name | split: ' ' %}
    {% assign lastname = "" %}
    {% assign person_first_name = "" %}
    {% 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 %}

as we then propose the variables person_first_name and lastname as defaults into the BE template Company Information (where you have the option to enter the first and last name too):

{% input person.custom.first_name default:person_first_name placeholder:"" %} 

Now, this seems much (and it is), but I wanted to point out it’s best to check how your .name is created: if all values are created as Joris Van Der Gucht eg, you know the very first part can be considered as the first name as well.

Hope this helps; let us know if it doesn’t