# How to retrieve historical information in details

**URL:** <https://community.silverfin.com/t/how-to-retrieve-historical-information-in-details/664>\
**Category:** Templates\
**Tags:** control\_flow, if, iterations, for\_loop, filter\_array\
**Created:** [February 21, 2018, 10:02am UTC](https://community.silverfin.com/t/how-to-retrieve-historical-information-in-details/664 "2018-02-21T10:02:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [February 22, 2018, 9:10pm UTC](https://community.silverfin.com/t/how-to-retrieve-historical-information-in-details/664/2 "2018-02-22T21:10:00Z")

</div>

@Bart_Verhaeghe,

Where do you want to retrieve this information? In the account template, or do you want to retrieve it somewhere else?

Part of your solution is in [here](https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275/5), if you want to retrieve it somewhere else.

And I don’t get your example; shouldn’t it be 100+50+60 = 210? 🤔

Whatever your object is where that data is stored for each stock movement, you’ll need to go over your collection again with a for-loop, and put an if-statement in there that adds the cumulative amount in a register. That register can be used for the total amount.

For example (this is just quickly an example) :

```auto
{% fori stock in custom.stocks %}
| {% input stock.date as:date %} | {% input stock.value as:currency %}
{% endfori %}

{% t "Input date calculate stock value" %}
{% input custom.date.calc as:date %}

{% for stock in custom.stocks %}
{% if custom.date.calc > stock.date %}
{% $1+ stock.value %}
{% endif %}
{% endfor %}

{% t "Stock value =" %}{{ $1 | currency }}

```

Can you try with this?

---

_[View the full topic](https://community.silverfin.com/t/how-to-retrieve-historical-information-in-details/664)._
