# Call value stored in handle based on string

**URL:** https://community.silverfin.com/t/call-value-stored-in-handle-based-on-string/2392
**Category:** Templates
**Tags:** drops, handle
**Created:** [January 20, 2023, 11:23am UTC](https://community.silverfin.com/t/call-value-stored-in-handle-based-on-string/2392 "2023-01-20T11:23:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![James](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@James](https://community.silverfin.com/u/James)
#### Post date: [January 20, 2023, 11:23am UTC](https://community.silverfin.com/t/call-value-stored-in-handle-based-on-string/2392/1 "2023-01-20T11:23:52Z")

</div>

I am trying to pull through data into a reconciliation from an account template. It works when I use the following code;

{{ period.reconciliations.maz\_fx\_rates.results.datapoint\_1612051200\_USD }}

however when I try to make this dynamic and build the string above it does not pull through the data. I am using the following code

{% assign current\_date\_seconds = period.end\_date | date:“%s” %}  
{{current\_date\_seconds | text}}  
{% capture datapoint %}{{current\_date\_seconds}}{% endcapture %}  
{%assign datapointString = ‘period.reconciliations.maz\_fx\_rates.results.datapoint\_’ | append: current\_date\_seconds | String %}

{{ datapointString; }}

---

<div class="post-metadata">

### Author: ![Romy\_Vermeeren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/romy_vermeeren/32/2295_2.png) [@Romy\_Vermeeren](https://community.silverfin.com/u/Romy_Vermeeren)
#### Post date: [January 23, 2023, 7:52am UTC](https://community.silverfin.com/t/call-value-stored-in-handle-based-on-string/2392/2 "2023-01-23T07:52:33Z")

</div>

Hi @James

In order to fetch the result, the result name should first be defined.  
The second issue is that you’re converting the reference to the result to a string.  
By doing so, that piece of code will not be executed when you print it.

What would work is the following, based on the result name you mentioned:

```auto
{% assign current_date_seconds = period.end_date | date:"%s" %}
{% capture result_name %}datapoint_{{ current_date_seconds }}_USD{% endcapture %}
{% assign result_value = period.reconciliations.maz_fx_rates.results.[result_name] %}

```

_If the USD isn’t fixed, that could be determined in a local variable just like current\_date\_seconds._

So you first need to get the entire result name in a dynamic variable (result\_name).  
Then you can use that result name to access the actual result from the template.

Note that you need to apply square brackets around the result name because it’s a dynamic variable, and that the local var result\_value is not a string, so no apostrophes.

Hope this helps you along!  
Kind regards,  
Romy
