# How to insert "tab" between two variables with Capture?

**URL:** <https://community.silverfin.com/t/how-to-insert-tab-between-two-variables-with-capture/2092>\
**Category:** Templates\
**Created:** [May 7, 2021, 3:26pm UTC](https://community.silverfin.com/t/how-to-insert-tab-between-two-variables-with-capture/2092 "2021-05-07T15:26:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahaegglund](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@ahaegglund](https://community.silverfin.com/u/ahaegglund)\
**Post date:** [May 7, 2021, 3:26pm UTC](https://community.silverfin.com/t/how-to-insert-tab-between-two-variables-with-capture/2092/1 "2021-05-07T15:26:02Z")

</div>

Hi,

We have a table where in one place we have a fori loop. The information in this fori will be used in a result and “moved” to another summarizing template (where we will have text from several modules).

I almost have what I want, but as you can see in the picture below, depending on how long item.company\_name\_paid\_by is, the item.amount\_paid is in different places. Is there someway to get these number to align?

{% assign test\_SE\_array = “” %}  
{% fori item in custom.booked\_company\_paid\_by %}  
{% capture holder %}{% t “fyll\_i\_bolagsnamn” %}{% endcapture %}  
| {% input item.company\_name\_paid\_by default:item.default\_text placeholder:holder %}  
{% rollforward item.company\_name\_paid\_by item.default\_text %}  
| {%=$0+input item.amount\_paid as:currency precision:0 placeholder:0 %}  
{% rollforward nil item.amount\_paid %}  
{% newline %}  
{% if forloop.first == true %}  
{% capture x %}Bolaget har i inkomstdeklarationen för beskattningsåret {{ fy }} mottagit koncernbidrag från följande bolag.{% endcapture %}  
{% capture y %}- {{ item.company\_name\_paid\_by }}    {{ item.amount\_paid }} {% endcapture %}  
{% assign test\_SE\_array = test\_SE\_array | append:x | append:"  
  
" %}  
{% assign test\_SE\_array = test\_SE\_array | append:y | append:"  
" %}  
{% elsif forloop.last == true %}  
{% capture y %}- {{ item.company\_name\_paid\_by }}    {{ item.amount\_paid }} {% endcapture %}  
{% assign test\_SE\_array = test\_SE\_array | append:"  
" | append:“Beloppet/beloppen har redovisats under kod 3.20 i Bolagets inkomstdeklaration.” %}  
{% else %}  
{% capture y %}- {{ item.company\_name\_paid\_by }}    {{ item.amount\_paid }} {% endcapture %}  
{% assign test\_SE\_array = test\_SE\_array | append:y | append:"  
" %}  
{% endif %}  
{% endfori %}

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/2X/7/7254e61994e90124c3a59604a292767822ee0daa.png)

Kind regards,  
Anna

---

<div class="post-metadata">

**Author:** ![Tom\_Worthington](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/tom_worthington/32/1579_2.png) [@Tom\_Worthington](https://community.silverfin.com/u/Tom_Worthington)\
**Post date:** [May 7, 2021, 4:57pm UTC](https://community.silverfin.com/t/how-to-insert-tab-between-two-variables-with-capture/2092/2 "2021-05-07T16:57:30Z")

</div>

Hi Anna,

Thanks for your question. Unfortunately, there is not a way to add a “tab” functionality in a string however we can align the results in another way. The easiest is to use a table to control the alignment and to facilitate this we will need to split the data up into separate arrays and variables. I have added two variables to store the text used and created two arrays for the table data:

{% stripnewlines %}  
{% comment %}Set-up arrays{% endcomment %}  
{% assign test\_SE\_array = “” %}  
{% assign test\_SE\_array\_numbers = “” %}

{% comment %}assign text variables{% endcomment %}  
{% assign text1 = “Bolaget har i inkomstdeklarationen för beskattningsåret {{ fy }} mottagit koncernbidrag från följande bolag.” %}  
{% assign text2 = “Beloppet/beloppen har redovisats under kod 3.20 i Bolagets inkomstdeklaration.” %}

{% fori item in custom.booked\_company\_paid\_by %}  
{% capture holder %}{% t “fyll\_i\_bolagsnamn” %}{% endcapture %}  
| {% input item.company\_name\_paid\_by default:item.default\_text placeholder:holder %}  
{% rollforward item.company\_name\_paid\_by item.default\_text %}  
| {%=$0+input item.amount\_paid as:currency precision:0 placeholder:0 %}  
{% rollforward nil item.amount\_paid %}  
{% newline %}

{% capture y %}-{{ item.company\_name\_paid\_by }}{% endcapture %}  
{% capture z %}{{ item.amount\_paid }}{% endcapture %}

{% assign test\_SE\_array = test\_SE\_array | append:y | append:"|" %}  
{% assign test\_SE\_array\_numbers = test\_SE\_array\_numbers | append:z | append:"|" %}

{% endfori %}  
{% endstripnewlines %}

{% comment %}Generate results for summary template{% endcomment %}  
{% result ‘text1’ text1 %}  
{% result ‘text2’ text2 %}  
{% result ‘test\_SE\_array’ test\_SE\_array %}  
{% result ‘test\_SE\_array\_numbers’ test\_SE\_array\_numbers %}

In the end template where you want the data to be displayed you can use the following code (variables will need to be replaced with the results eg. period.reconciliations.HANDLE.results.text1):

{% comment %}To display result data{% endcomment %}  
{% assign test\_SE\_array = test\_SE\_array | split:"|" %}  
{% assign test\_SE\_array\_numbers = test\_SE\_array\_numbers | split:"|" %}

{% stripnewlines %}  
{{ text1 }}  
{% newline %}{% newline %}

{% for item in test\_SE\_array %}  
{% if forloop.first == true %}  
{% comment %}table format{% endcomment %}  
{% newline %}  
|—20%—  
|—10%—  
{% newline %}  
|{{ item }}  
|{{ test\_SE\_array\_numbers.[forloop.index0] }}  
{% else %}  
{% newline %}  
|{{ item }}  
|{{ test\_SE\_array\_numbers.[forloop.index0] }}  
{% endif %}  
{% endfor %}

{% comment %}last sentence{% endcomment %}  
{% newline %}{% newline %}  
{{ text2 }}  
{% endstripnewlines %}

Hope that helps. Let us know if I can help clarify any points.
