# Creating global functions by means of 'capture', but with local variables

**URL:** <https://community.silverfin.com/t/creating-global-functions-by-means-of-capture-but-with-local-variables/1235>\
**Category:** Templates\
**Created:** [October 9, 2018, 8:21am UTC](https://community.silverfin.com/t/creating-global-functions-by-means-of-capture-but-with-local-variables/1235 "2018-10-09T08:21:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bart\_Verhaeghe](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bart\_Verhaeghe](https://community.silverfin.com/u/Bart_Verhaeghe)\
**Post date:** [October 9, 2018, 8:21am UTC](https://community.silverfin.com/t/creating-global-functions-by-means-of-capture-but-with-local-variables/1235/1 "2018-10-09T08:21:32Z")

</div>

Good morning gentlemen,

A question with regard to the following scripts:

I’ve got the following script in a reconciliation template ‘Testje’:

```
{% capture Test %}hallo{% endcapture %}

{% result 'Test' Test %}

{% capture str_Paragraaf1 %}
  {{int_Parameter1}}
{% endcapture %}

{% result 'str_Paragraaf1' str_Paragraaf1 %}

```

I’ve also got the following script in a text template:

```
{% assign TestLokaal = period.reconciliations.Testje.results.Test %}
{% assign str_Paragraaf1Lokaal = period.reconciliations.Testje.results.str_Paragraaf1 %}

variabele {{TestLokaal}}

{% assign int_Parameter1 = 5 %}

str_Paragraaf1: {{str_Paragraaf1Lokaal | plus:1}}

```

Now, 'variabele {{TestLokaal}} gives me the expected output (being ‘variabele hallo’). I’d like to get my second function to give me ‘6’, being 5 defined by int\_Parameter1 in the text template but referenced in the reconciliation template (this last bit is very important, as I’d like to get more and more of my functions in a reconciliation template (by means of ‘capture’) so I’d only have to define them once and reuse them every time with local variables.

However, the result is 1 as he does not find a value ‘int\_Parameter1’ in the reconciliation template.

Is there another/better way to do this?

Thanks!

---

<div class="post-metadata">

**Author:** ![Sofie\_Cleemput](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sofie_cleemput/32/709_2.png) [@Sofie\_Cleemput](https://community.silverfin.com/u/Sofie_Cleemput)\
**Post date:** [October 9, 2018, 12:20pm UTC](https://community.silverfin.com/t/creating-global-functions-by-means-of-capture-but-with-local-variables/1235/2 "2018-10-09T12:20:50Z")

</div>

Hi Bart

the reuse which you are referring too, is not possible at the moment. However, this function will be foreseen in the future, although we can not put an exact timing on it.

Kind regards  
Sofie

---

<div class="post-metadata">

**Author:** ![Bart\_Verhaeghe](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bart\_Verhaeghe](https://community.silverfin.com/u/Bart_Verhaeghe)\
**Post date:** [October 9, 2018, 12:34pm UTC](https://community.silverfin.com/t/creating-global-functions-by-means-of-capture-but-with-local-variables/1235/3 "2018-10-09T12:34:39Z")

</div>

Hi Sofie,

Thank you for the response.

Could you keep me informed when this way of working is available (or if you have an alternative)?

Have a great day,

**Bart Verhaeghe**

analyse & rapportering

![](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/c77abff9261da73dbad1cfdfd0bffb6c582bd1c5.jpeg)

![](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/59d413e060286dbeadcb592b819a1893844599bf.png)

![](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/ede6b453715eb56ea1767f1330f41de09d3667af.png)

![](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/aecfbd2ce8bae99a00e5751d80e9318851f4b797.png)
