This is only the case if you want to use your own count of present shareholders or directors for instance.
In our own standard templates this is done automatically.
F.i. any given director, will be saved in a special drop {{ period.directors }}.
If you want to know how many directors there are, just add a ‘count’ to the drop, just like this :
{{ period.directors.count }}
You could do this with shareholders as well :
{{ period.shareholders.count }}
But what if you want to add an extra column where it is marked who was present during the AV?
To give an overview (which we are going to use later on) of all the directors, you could use this :
{% for director in period.directors %}
{{ director.name }}
{% endfor %}
This list can be updated with an extra column, that we are going to use to mark if a director is present :
| Name | Present? |
|-------|-----------:{% for director in period.directors %}
| {{ director.name }} | {% input director.custom.present as:boolean %}{% endfor %}
Our result is this :
But how can we count the ones who were checked as present?
First, it’s only when the variable director.custom.present is checked, something should be counted.
This is the code :
{% if director.custom.present == 'true' %}
So the value ‘true’ is given to the variable when being checked.
Now, we also need to create a variable which the count of the present directors will be in done.
We put it on zero first:
{% assign count_present = 0 %}
Then, we will add ‘plus 1’ every time there’s a checked mark :
{% for director in period.directors %}
{% if director.custom.present == 'true' %}{% assign count_present = count_present | plus:1 %}{% endif %}
{% endfor %}
Above code will go through every loop (f.i. 3 directors, so the iteration of a loop will be done 3 times). And with every loop, there will only be added 1 to the variable if the variable is checked.
Now, we can use the variable later on to display the number of directors who were marked as present :
{{ count_present }}