# For loop - reproduction of table in other reconcilation

**URL:** https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77
**Category:** Templates
**Tags:** tables, drops, for\_loop, drop\_period
**Created:** [February 23, 2017, 1:11pm UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77 "2017-02-23T13:11:30Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![nlondoz](https://avatars.discourse-cdn.com/v4/letter/n/b2d939/32.png) [@nlondoz](https://community.silverfin.com/u/nlondoz)
#### Post date: [February 23, 2017, 1:11pm UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/1 "2017-02-23T13:11:30Z")

</div>

Hi,

I want to reproduce this table below in another reconciliation. How can I do this?  
For results or customs I add period.reconciliations.handle…  
But for tables I do not know were to put the period.reconciliatons.handle…? Or do I have to capture it and then reproduce?

Is it also possible to reproduce only one collumn of the table in another reconcilation?

Thanks!

```auto

{% addnewinputs %}
{% assign lines = custom.lines | sort:'a2'%}
{% endaddnewinputs %}

| {% t "Exemption classification"%} | {% t "Tax year-number" %} | {% t "Name beneficiary" %} | {% t "Adress beneficiary" %} | {% t "Debt claim, start of the taxable period" %} | {% t "Debt claim, end of the taxable period" %} | {% t "Exempt write down, start of the taxable period" %} | {% t "Exempt write down, end of the taxable period" %} | 
|:---:|:--6%----|:-----------10%---------|:--------10%---|----15%-------:|----15%----:|-----15%-----:|---15%--:+{% for line in lines %}
{% stripnewlines %}
 |{% input line.category_a as:select options:"Increase|Decrease|New|Unaltered" option_values:"1|2|3|4" %} 
 |{% input line.year_a as:number placeholder:'' %} 
 |{% input line.name_a placeholder:''%}
 |{% input line.adress_a placeholder:''%}
 |{% input line.debt_claim_start_a placeholder:'' %}
 |{% input line.debt_claim_end_a placeholder:''%}
 |{%$1+input line.exempt_write_down_start_a as:currency placeholder:''%}
 |{%=$2+input line.exempt_write_down_end_a as:currency placeholder:'' %}
{% endstripnewlines %} {% endfor %}
| | | | | | | ***{{ $1 | currency }}*** | ***{{ $2 | currency }}*** | 

```

---

<div class="post-metadata">

### Author: ![michail](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/michail/32/8_2.png) [@michail](https://community.silverfin.com/u/michail)
#### Post date: [February 24, 2017, 9:42am UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/2 "2017-02-24T09:42:52Z")

</div>

Hello @nlondoz,

As far as I know, you are not able to use a table in another reconciliation. IF there is a way, then what you suggested is the only way. Try to capture it and then reproduce it. But I am not sure if this is going to work either. You can try it thought and if it doesn’t work you can drop a reply here and I will have a discuss with my colleagues about your issue.

Regards,  
Michail

---

<div class="post-metadata">

### Author: ![GMOONS](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@GMOONS](https://community.silverfin.com/u/GMOONS)
#### Post date: [February 24, 2017, 2:02pm UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/3 "2017-02-24T14:02:31Z")

</div>

Hello @michail,

We’ve tried to capture and reproduce the table within the same form. with the capture option.  
It worked, however we still try to reproduce the captured table in another form.

If it would have been a variable, it would have been: period.reconciliations.handle.custom.some.thing  
But now the variable is a capture function. How can we adress the capture function in the other form; like: [period.reconciliations.handle.capture.name](http://period.reconciliations.handle.capture.name) ?

Kind regards,

Glenn

---

<div class="post-metadata">

### Author: ![Tim](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/tim/32/1304_2.png) [@Tim](https://community.silverfin.com/u/Tim)
#### Post date: [March 1, 2017, 8:49am UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/4 "2017-03-01T08:49:27Z")

</div>

Hi @GMOONS,

You can put the variable of the capture in a result tag. So you could do the following:

```auto
{% capture 'the_form' %}GENERATE THE FORM{% endcapture %}
{% result 'the_form' the_form %} 

```

In another template you could do

```auto
{{ period.reconciliations.handle.results.the_form }}

```

---

<div class="post-metadata">

### Author: ![marnixcoudre](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@marnixcoudre](https://community.silverfin.com/u/marnixcoudre)
#### Post date: [March 2, 2017, 10:52am UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/5 "2017-03-02T10:52:32Z")

</div>

Hi,

I was able to reproduce a table in another form with the above capture code.

But now I have the issue that there is a fori loop in my table so that I Always have one row extra if I input a row and when I display my table with the capture tag I also have the last row with all 0.

So now my question: is it possible to capture a table minus the last row?

My code in form A:

```auto
{% addnewinputs %}
{% assign lines = custom.lines | sort:'a1' %}
{% endaddnewinputs %}

{% assign a1 = custom.capitalgain.shareholder %}
{% assign a2 = custom.capitalgain.total_amount %}
{% assign a3 = custom.capitalgain.exempt %}
{% assign a4 = custom.capitalgain.taxed0 %}
{% assign a5 = custum.capitalgain.taxed25 %}
{% assign a6 = custom.capitalgain.taxed33 %}

| {% t "Name subsidiary" %} | {% t "Total amount" ´%} | {% t "Exempt amount" %} | {% t "Taxed at 0,412%" %} | **{% t "Taxed at 25,75%" %}** | **{% t "Taxed at 33,99%" %}**
|:--------------------------|:-------------------------|:------------------------|:--------------------------|:------------------------------|:----+{% for line in lines %}
{% stripnewlines %}
  |{% input line.a1 as placeholder:"Name" %} 
  |{% input line.a2 as:currency as placeholder:"Value" %}
  |{% input line.a3 as:currency as placeholder:"Value" %} 
  |{% input line.a4 as:currency as placeholder:"Value" %} 
  |{% input line.a5 as:currency as placeholder:"Value" %}
  |{% input line.a6 as:currency as placeholder:"Value" %}
{% endstripnewlines %}{% endfor %}

{% capture 'Capital_gain_table' %}

| {% t "Name subsidiary" %} | {% t "Total amount" ´%} | {% t "Exempt amount" %} | {% t "Taxed at 0,412%" %} | **{% t "Taxed at 25,75%" %}** | **{% t "Taxed at 33,99%" %}**
|:--------------------------|:-------------------------|:------------------------|:--------------------------|:------------------------------|:----+{% for line in lines %}
{% stripnewlines %}
  |{{ line.a1 }} 
  |{{ line.a2 }}
  |{{ line.a3 }} 
  |{{ line.a4 }} 
  |{{ line.a5 }}
  |{{ line.a6 | currency }}
{% endstripnewlines %}{% endfor %}

{% endcapture %}

```

My code in form B:

```auto
{{ period.reconciliations.working_docs.results.Capital_gain_table }}

```

Thanks in advance

---

<div class="post-metadata">

### Author: ![GMOONS](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@GMOONS](https://community.silverfin.com/u/GMOONS)
#### Post date: [March 2, 2017, 11:22am UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/6 "2017-03-02T11:22:23Z")

</div>

Dear Tim,

Thanks for the prompt answer!

Indeed, I was able to reproduce my table in another form.  
First of all I have the same question as Marnix has.

Secondly, I have the following issue as well:

I capture my fori loop table by using in the capture a calculation, now in my second form I want to check whether the calculation within the captured table != 0 to display the captured table or not. Below is the code used, however the If-check does not seem to work. Can you help me out on that one as well?

Kind regards,

Glenn

Code in form 1:

```auto
{% capture 'taxable_reserves' %}

|----80%-----|:--------10%-----:|---10%----------:+{% fori taxable in custom.taxable_reserves %} 
{% stripnewlines %}
| {{ taxable.description }}
|
| {{ taxable.reserves_CY-taxable.reserves_LY |currency }} 
{% endstripnewlines %}{% endfori %}

{% endcapture %}
{% result 'taxable_reserves' taxable_reserves %}

```

code in form 2:

```auto
{% if period.reconciliations.reserves_and_dividends.other.reserves_CY-period.reconciliations.reserves_and_dividends.other.reserves_LY != 0 %}

{{ period.reconciliations.reserves_and_dividends.results.other_reserves }} {% else %}{% endif %}

{% if period.reconciliations.reserves_and_dividends.taxable.reserves_CY-period.reconciliations.reserves_and_dividends.taxable.reserves_LY != 0 %}

{{ period.reconciliations.reserves_and_dividends.results.taxable_reserves }} {% else %} {% endif %}

```

---

<div class="post-metadata">

### Author: ![Tim](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/tim/32/1304_2.png) [@Tim](https://community.silverfin.com/u/Tim)
#### Post date: [March 2, 2017, 2:58pm UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/7 "2017-03-02T14:58:41Z")

</div>

@marnixcoudre the thing is, at the top of the template you explicitly add an extra item (that’s what the `addnewinputs` tag does.

It’s probably best to do something like:

```auto
{% addnewinputs %}
{% assign lines = custom.lines | sort:'a1' %}
{% endaddnewinputs %} 
{% assign lines_without_extra_input = custom.lines | sort:'a1' %}

```

and for the form you want to capture, you can use the variable `lines_without_extra_input`

---

<div class="post-metadata">

### Author: ![Tim](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/tim/32/1304_2.png) [@Tim](https://community.silverfin.com/u/Tim)
#### Post date: [March 2, 2017, 3:05pm UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/8 "2017-03-02T15:05:38Z")

</div>

@GMOONS wrt the code in form 2, do you want to address a `result` with `period.reconciliations.reserves_and_dividends.other.reserves_CY`?

Because then you’re probably missing the `results` in the if (I see you’re using the variable with `results` when you print it: `period.reconciliations.reserves_and_dividends.results.other_reserves`

---

<div class="post-metadata">

### Author: ![GMOONS](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@GMOONS](https://community.silverfin.com/u/GMOONS)
#### Post date: [March 2, 2017, 3:19pm UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/9 "2017-03-02T15:19:01Z")

</div>

Hi @Tim

In the code in form 2 I would like to test whether the variable other.reserves\_CY-other.reservesLY != 0 and if that’s the case that the captured table would be displayed.

As such I’m adressing the variable within the table and not the result (= captured table).

however I get an error that the method to\_d is not defined?

Kind regards,

Glenn

---

<div class="post-metadata">

### Author: ![marnixcoudre](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@marnixcoudre](https://community.silverfin.com/u/marnixcoudre)
#### Post date: [March 2, 2017, 3:29pm UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/10 "2017-03-02T15:29:09Z")

</div>

@ Tim

Thanks for the solution!

---

<div class="post-metadata">

### Author: ![Tim](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/tim/32/1304_2.png) [@Tim](https://community.silverfin.com/u/Tim)
#### Post date: [March 2, 2017, 4:44pm UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/11 "2017-03-02T16:44:47Z")

</div>

@GMOONS I think you probably want to access the variables of that template then? So you’re missing `custom`:

`period.reconciliations.reserves_and_dividends.custom.other.reserves_CY`  
iso  
`period.reconciliations.reserves_and_dividends.other.reserves_CY`

correct?

---

<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: [May 4, 2017, 8:17pm UTC](https://community.silverfin.com/t/for-loop-reproduction-of-table-in-other-reconcilation/77/12 "2017-05-04T20:17:11Z")

</div>


