# Calculating with registers (amount of shares)

**URL:** <https://community.silverfin.com/t/calculating-with-registers-amount-of-shares/553>\
**Category:** Templates\
**Tags:** math, iterations, for\_loop, register\
**Created:** [December 22, 2017, 8:16am UTC](https://community.silverfin.com/t/calculating-with-registers-amount-of-shares/553 "2017-12-22T08:16:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![b.dalle](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/b.dalle/32/2305_2.png) [@b.dalle](https://community.silverfin.com/u/b.dalle)\
**Post date:** [December 22, 2017, 8:16am UTC](https://community.silverfin.com/t/calculating-with-registers-amount-of-shares/553/1 "2017-12-22T08:16:19Z")

</div>

In a text i’m creating for ‘Notulen’ Im trying to calculate an amount in combination with the total amount of shares by using registers.

However, I can’t seem to find an easy way to solve this. So what I’ve done is using the following code in order to fill the register $6:

`{% ic %}{% for x in period.shareholders %}<font color="white">{%=$6+ x.amount_of_shares%}</font>{% endfor %}{% endic %}`

As I save the text it works and I can calculate with the register $6.  
However, when I export this text, the register is empy and the calculation is wrong, probably due to te code {% ic %}{% endic %}. But clearly I don’t want the piece of code to show up on an export.

Is there a way to work around it?

---

<div class="post-metadata">

**Author:** ![SamVanEenoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/samvaneenoo/32/134_2.png) [@SamVanEenoo](https://community.silverfin.com/u/SamVanEenoo)\
**Post date:** [December 22, 2017, 11:36am UTC](https://community.silverfin.com/t/calculating-with-registers-amount-of-shares/553/2 "2017-12-22T11:36:58Z")

</div>

This should do the trick

> {% for x in period.shareholders %}{% $6+ x.amount\_of\_shares%}{% endfor %}{% ic %}{{$6}}{% endic %}

Kind regards

---

<div class="post-metadata">

**Author:** ![b.dalle](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/b.dalle/32/2305_2.png) [@b.dalle](https://community.silverfin.com/u/b.dalle)\
**Post date:** [December 22, 2017, 11:59am UTC](https://community.silverfin.com/t/calculating-with-registers-amount-of-shares/553/3 "2017-12-22T11:59:23Z")

</div>

When I put that coe in, i get this result on

 ![Capture](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/4162376e0d86f6e6d0157981927312b66f942a81.JPG)

Looks to me the fontcolor is not working. I want to put the result in white because i dont want to let it show this dat on my screen when entering the template

---

<div class="post-metadata">

**Author:** ![b.dalle](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/b.dalle/32/2305_2.png) [@b.dalle](https://community.silverfin.com/u/b.dalle)\
**Post date:** [December 22, 2017, 12:29pm UTC](https://community.silverfin.com/t/calculating-with-registers-amount-of-shares/553/4 "2017-12-22T12:29:40Z")

</div>

I’ve already found it.

Before I used the code  
`{% for x in period.shareholders %}{%=$6+ x.amount_of_shares%}{% endfor %}`

and the values of $6 were displayed, however when I use your code it works just fine

`{% for x in period.shareholders %}{% $6+ x.amount_of_shares%}{% endfor %}`

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![SamVanEenoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/samvaneenoo/32/134_2.png) [@SamVanEenoo](https://community.silverfin.com/u/SamVanEenoo)\
**Post date:** [December 27, 2017, 9:29am UTC](https://community.silverfin.com/t/calculating-with-registers-amount-of-shares/553/5 "2017-12-27T09:29:46Z")

</div>

Also I wanted to let you know that when using font color. You can’t use words like ‘white’ in liquid. It needs to be a hexadecimal rgb notation. For exemple white would be FFFFFF.
