# General company info is deleted

**URL:** <https://community.silverfin.com/t/general-company-info-is-deleted/2314>\
**Category:** Templates\
**Created:** [July 4, 2022, 10:39am UTC](https://community.silverfin.com/t/general-company-info-is-deleted/2314 "2022-07-04T10:39:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JelleBe](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@JelleBe](https://community.silverfin.com/u/JelleBe)\
**Post date:** [July 4, 2022, 10:39am UTC](https://community.silverfin.com/t/general-company-info-is-deleted/2314/1 "2022-07-04T10:39:24Z")

</div>

Hi there

If I use the directors of the current period in combination with a mapped account in a template, the users are able to overwrite the amount of the account, but also to delete it if it’s wrong. If they delete this line, the director and the amount are deleted in the template (which is correct), but also in the general company information. This should be avoided of course, but how…  
I’ve tried already to but the period directors into another variable through using assign and displaying that variable, but still it deletes the director in the general company information if you delete it in the template. So currently I’m looping over the active directors and I put the active directors into another variable, but it doesn’t help.  
Can someone help me out?

Thanks! 🙂

---

<div class="post-metadata">

**Author:** ![Michiel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/michiel/32/2364_2.png) [@Michiel](https://community.silverfin.com/u/Michiel)\
**Post date:** [July 4, 2022, 3:14pm UTC](https://community.silverfin.com/t/general-company-info-is-deleted/2314/2 "2022-07-04T15:14:44Z")

</div>

Hi @JelleBe ,

I’m wondering what exactly you mean by ‘_If I use the directors of the current period in combination with a mapped account_’. Can you show me this codewise?

In Silverfin, however, it’s always the case that if you click the bin for a certain field of an iteration in your collection (for example the name of a director in your people collection ), that iteration (=director) will be removed.

Kind regards,

Michiel

---

<div class="post-metadata">

**Author:** ![JelleBe](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@JelleBe](https://community.silverfin.com/u/JelleBe)\
**Post date:** [July 7, 2022, 5:59am UTC](https://community.silverfin.com/t/general-company-info-is-deleted/2314/3 "2022-07-07T05:59:18Z")

</div>

Hi Michiel

Thank you for your answer.  
This is the code we currently use for it:  
{% stripnewlines %}  
| {% ifi show\_bez\_bl or show\_extra\_bez\_bl %}| | Vergoeding{% endifi %}{% ifi show\_vaa\_bl or show\_extra\_vaa\_bl %}| | Voordelen alle aard {% endifi %}  
{% newline %}  
|:------------------------------------|----10%—|-------:|----10%—|-----------:  
{% for zaakvoerder in period.directors %}

{% unless zaakvoerder.director\_end\_date != blank and zaakvoerder.director\_end\_date \< period.year\_start\_date %}

{% comment %}it is the db var “represented\_by\_name” that decides if a person is legal or not - needed for default dropdown LEGAL OR NOT{% endcomment %}  
{% assign default\_type = “” %}  
{% if zaakvoerder.custom.represented\_by\_name != blank %}  
{% assign default\_type = “legal” %}  
{% else %}  
{% assign default\_type = “nature” %}  
{% endif %}  
{% comment %}look at the dropdown to check whether someone is LEGAL or not{% endcomment %}  
{% assign type = zaakvoerder.custom.type | default:default\_type %}

{% assign current\_director = “” %}  
{% assign words = zaakvoerder.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 %}  
{% if type == “legal” %}  
{% assign current\_director = zaakvoerder.name %}  
{% else %}  
{% if zaakvoerder.custom.first\_name == blank and zaakvoerder.custom.last\_name == blank %}  
{% assign current\_director = zaakvoerder.name %}  
{% elsif zaakvoerder.custom.first\_name == blank and zaakvoerder.custom.last\_name != blank %}  
{% assign current\_director = current\_director | append:person\_first\_name | append:" " | append:zaakvoerder.custom.last\_name %}  
{% elsif zaakvoerder.custom.first\_name != blank and zaakvoerder.custom.last\_name == blank %}  
{% assign current\_director = current\_director | append:zaakvoerder.custom.first\_name | append:" " | append:lastname %}  
{% else %}  
{% assign current\_director = current\_director | append:zaakvoerder.custom.first\_name | append:" " | append:zaakvoerder.custom.last\_name %}  
{% endif %}  
{% endif %}  
{% if type == “legal” %}  
{% case zaakvoerder.custom.company\_form %}  
{% when 1 %}{% assign legal\_type = ‘SCE’ %}  
{% when 2 %}{% assign legal\_type = ‘OFP’ %}  
{% when 6 %}{% assign legal\_type = ‘CVOA’ %}  
{% when 8 %}{% assign legal\_type = ‘CVBA’ %}  
{% when 11 %}{% assign legal\_type = ‘VOF’ %}  
{% when 12 %}{% assign legal\_type = ‘CV’ %}  
{% when 13 %}{% assign legal\_type = ‘COMMVA’ %}  
{% when 14 %}{% assign legal\_type = ‘NV’ %}  
{% when 15 %}{% assign legal\_type = ‘BVBA’ %}  
{% when 21 %}{% assign legal\_type = ‘OVM’ %}  
{% when 17 %}{% assign legal\_type = ‘VZW’ %}  
{% when 27 %}{% assign legal\_type = ‘SE’ %}  
{% when 18 %}{% assign legal\_type = ‘ION’ %}  
{% when 30 %}{% assign legal\_type = ‘Buitenlandse onderneming’ %}  
{% when 60 %}{% assign legal\_type = ‘ESV’ %}  
{% when 23 %}{% assign legal\_type = ‘Buitenlandse privaatrechtelijke vereniging met vestiging, agentschappen, kantoor of bijhuis in België’ %}  
{% when 65 %}{% assign legal\_type = ‘EESV’ %}  
{% when 26 %}{% assign legal\_type = ‘PRIV ST’ %}  
{% when 265 %}{% assign legal\_type = ‘Europees economisch samenwerkingsverband zonder zetel met vestiging in België’ %}  
{% when 506 %}{% assign legal\_type = ‘CVOA SO’ %}  
{% when 29 %}{% assign legal\_type = ‘SON’ %}  
{% when 508 %}{% assign legal\_type = ‘CVBA SO’ %}  
{% when 511 %}{% assign legal\_type = ‘VOF SO’ %}  
{% when 512 %}{% assign legal\_type = ‘GCV SO’ %}  
{% when 513 %}{% assign legal\_type = ‘CVA SO’ %}  
{% when 121 %}{% assign legal\_type = ‘Onderlinge verzekeringsmaatschappij, van publiek recht’ %}  
{% when 514 %}{% assign legal\_type = ‘NV SO’ %}  
{% when 125 %}{% assign legal\_type = ‘IVZW’ %}  
{% when 510 %}{% assign legal\_type = ‘BVBA SO’ %}  
{% when 560 %}{% assign legal\_type = ‘ESV SO’ %}  
{% endcase %}  
{% assign current\_director = current\_director %}  
{% endif %}  
{% assign bez\_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging\_range %}  
{% assign zaakvoerder\_bezoldiging\_check = zaakvoerder.custom.bezoldiging | default:bez\_waarde %}  
{% assign vaa\_waarde = period.accounts | range:zaakvoerder.custom.vaa\_range %}  
{% assign zaakvoerder\_vaa\_check = zaakvoerder.custom.vaa | default:vaa\_waarde %}  
{% ifi zaakvoerder\_vaa\_check != 0 or zaakvoerder\_bezoldiging\_check != 0 %}  
{% newline %}  
| {{ current\_director }}&nbsp;&nbsp;&nbsp;&nbsp;  
{% ifi zaakvoerder\_bezoldiging\_check != 0 %}  
| {% input zaakvoerder.custom.bezoldiging\_range as:account\_collection range:618,62,74 accounts\_var:bez %}{% rollforward nil zaakvoerder.custom.bezoldiging\_range %}  
{% assign abs\_bez = bez.6-bez.7 %}  
| {% input zaakvoerder.custom.bezoldiging default:abs\_bez as:currency %}{% rollforward nil zaakvoerder.custom.bezoldiging %}  
{% else %}  
||  
{% endifi %}  
{% ifi zaakvoerder\_vaa\_check != 0 %}  
| {% input zaakvoerder.custom.vaa\_range as:account\_collection range:74,618 accounts\_var:vaa %}{% rollforward nil zaakvoerder.custom.vaa\_range %}  
{% assign abs\_vaa = vaa.6-vaa.7 %}  
|{% input zaakvoerder.custom.vaa default:abs\_vaa as:currency %}{% rollforward nil zaakvoerder.custom.vaa %}  
{% else %}  
||  
{% endifi %}  
{% endifi %}  
{% endunless %}  
{% endfor %}  
{% fori bezoldiging in period.custom.extra\_bezoldiging %}  
{% assign bez\_waarde\_extra = period.accounts | range:bezoldiging.bezoldinging\_range %}  
{% assign zaakvoerder\_bezoldiging\_check\_extra = bezoldiging.bedrag | default:bez\_waarde\_extra %}  
{% assign vaa\_waarde\_extra = period.accounts | range:bezoldiging.accounts %}  
{% assign zaakvoerder\_vaa\_check\_extra = bezoldiging.vaa\_extra | default:vaa\_waarde\_extra %}  
{% ifi zaakvoerder\_bezoldiging\_check\_extra != 0 or zaakvoerder\_vaa\_check\_extra != 0 %}  
{% newline %}  
| {% input bezoldiging.name %}{% rollforward nil bezoldiging.name %}  
{% ifi zaakvoerder\_bezoldiging\_check\_extra != 0 %}  
| {% input bezoldiging.bezoldinging\_range as:account\_collection range:618,62,74 accounts\_var:bez\_bez %}{% rollforward nil bezoldiging.bezoldinging\_range %}  
{% assign abs\_bez\_bez = bez\_bez.6-bez\_bez.7 %}  
| {% input bezoldiging.bedrag default:abs\_bez\_bez as:currency %}{% rollforward nil bezoldiging.bedrag %}  
{% else %}  
||  
{% endifi %}  
{% ifi zaakvoerder\_vaa\_check\_extra != 0 %}  
| {% input bezoldiging.accounts as:account\_collection range:74,618 accounts\_var:extra\_vaa %}{% rollforward nil bezoldiging.accounts %}  
{% assign abs\_extra\_vaa = extra\_vaa.6-extra\_vaa.7 %}  
|{% input bezoldiging.vaa\_extra default:abs\_extra\_vaa as:currency %}{% rollforward nil bezoldiging.vaa\_extra %}  
{% else %}  
||  
{% endifi %}  
{% endifi %}  
{% endfori %}  
{% endstripnewlines %}

![image](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/2X/2/2912bd9e55741a4e4f2b8e30ae8ee627413fe2cb.png)

This is quiet a lot. But It thought if I do a loop over the directors and place them into another variable in this template, that I can delete the information without deleting the directors in the general company info. Isn’t this possible?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Michiel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/michiel/32/2364_2.png) [@Michiel](https://community.silverfin.com/u/Michiel)\
**Post date:** [July 7, 2022, 7:08am UTC](https://community.silverfin.com/t/general-company-info-is-deleted/2314/4 "2022-07-07T07:08:07Z")

</div>

Hi @JelleBe ,

Please keep in mind we have some [standards available](https://community.silverfin.com/t/how-to-paste-your-code-in-a-community-post/64) on how to post your code on the community.

A solution to your problem is to create a custom variable that is using the persistent id of a person as a variable part in the name. The persistent id of a person in the people drop remains the same over time (unlike the person.id which changes over time and therefor might lead to rollforwarding issues).

The advantage of this solution is that each director will have a variable that is uniquely linked to him/her but it will not remove the director from the people collection when the renumeration variable is cleared!

```auto
{% for director in period.directors %}
  | {{ director.name }}
  {% capture person_id %}person_{{ director.persistent_id }}{% endcapture %}
  | {% input custom.[person_id].renumeration %}
{% endfor %}

```

Kind regards,  
Michiel

---

<div class="post-metadata">

**Author:** ![JelleBe](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@JelleBe](https://community.silverfin.com/u/JelleBe)\
**Post date:** [July 7, 2022, 3:11pm UTC](https://community.silverfin.com/t/general-company-info-is-deleted/2314/5 "2022-07-07T15:11:44Z")

</div>

Thanks Michiel for the tips & tricks.

We will have to revise the code and try it with yours. Thanks.

Kind regards  
Jelle
