# How to place a total at the top of a page above any other code

**URL:** <https://community.silverfin.com/t/how-to-place-a-total-at-the-top-of-a-page-above-any-other-code/1035>\
**Category:** Templates\
**Tags:** input, capture\
**Created:** [July 3, 2018, 10:07am UTC](https://community.silverfin.com/t/how-to-place-a-total-at-the-top-of-a-page-above-any-other-code/1035 "2018-07-03T10:07:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NickS](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@NickS](https://community.silverfin.com/u/NickS)\
**Post date:** [July 3, 2018, 10:07am UTC](https://community.silverfin.com/t/how-to-place-a-total-at-the-top-of-a-page-above-any-other-code/1035/1 "2018-07-03T10:07:47Z")

</div>

Which code can you use to place a total amount at the top of a page, so above any other code.  
I tried with assign and with $ but that does not work.

---

<div class="post-metadata">

**Author:** ![robindeclercq](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/robindeclercq/32/472_2.png) [@robindeclercq](https://community.silverfin.com/u/robindeclercq)\
**Post date:** [July 5, 2018, 7:09am UTC](https://community.silverfin.com/t/how-to-place-a-total-at-the-top-of-a-page-above-any-other-code/1035/2 "2018-07-05T07:09:23Z")

</div>

Hi @NickS,

When the total amount is calculated within the template, it will not display above the calculation as liquid-code reads from top to bottom. A simple way to show the total amount on top is to capture the input or calculation, and display it underneath the total amount. Please find a simple example hereafter:

> {% capture inputfields %}  
> {% $0+input custom.number.one as:integer %}  
> {% $0+input custom.number.two as:integer %}  
> {% endcapture %}
> 
> {{ $0 | integer }}
> 
> {{ inputfields }}

However, in the above example it is also possible to calculate the total amount as follows:

> {{ custom.number.one+custom.number.two | integer }}  
> {% input custom.number.one as:integer %}  
> {% input custom.number.two as:integer %}

This way, the total amount will show on top of the page, as the ‘custom.’ input is a database variable, which can be displayed anywhere.

Hope this helps!

Kind regards,  
Robin

---

<div class="post-metadata">

**Author:** ![NickS](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@NickS](https://community.silverfin.com/u/NickS)\
**Post date:** [July 6, 2018, 5:33am UTC](https://community.silverfin.com/t/how-to-place-a-total-at-the-top-of-a-page-above-any-other-code/1035/3 "2018-07-06T05:33:14Z")

</div>

Hi @robindeclercq

Thanks  
Have a nice day.
