Two table formats in reconciliation template

Hi,
I have two tables one next to another with different layout.
When period is unlocked template looks fine however when period is locked second table definition is displayed as text and table structure is broken.
I noticed it happens if second table (header) structure is in capture tag and the input field is blank.

How can I make second table to keep its structure when period is locked?

Below is the code and screenshots of the result:


{% capture "headercontent" %}|--23%--|--45%--|--15%--|----+{% endcapture %}
{% capture "header" %}|--10%--|--5%--|--8%--|--45%--|--15%--|----+{% endcapture %}
{% capture "header_notes" %}|----|------+{% endcapture %}

**<font size = "5" > CIS - {{company.name}}&nbsp;&nbsp;({{company.vat_identifier}}) </font>**
<hr>
{% stripnewlines %}
{% newline %}
**Confirmation of supplier status**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**Notes**&nbsp;&nbsp;&nbsp;&nbsp; {% input custom.note.0_0 as:boolean %}

{%if custom.note.0_0 == "true" %}{% newline %}{% input custom.addnote.0_0 as text size:mini placeholder:"Add notes" %} {% endif%}
{% endstripnewlines %}

{% stripnewlines %}
{{headercontent}}{% newline %}
{% fori attachement in custom.attachements_0_0 %}
|{% input attachement.file_0_0 as:file_collection size:max %}
|{% if attachement.file_0_0.document != blank %}{% input attachement.description_0_0 placeholder:"Description" %}{% endif %} 
| {{ attachement.0_0.updated_by.name }}
| {{ attachement.0_0.updated_at | date:"%d/%m/%Y %H:%M" }}{% newline %}
{% endfori %}
{% endstripnewlines %}

<hr>

{% stripnewlines %}
{{headercontent}}{% newline %}
|_**Report**_|_**Descriptin**_|_**Initials**_|_**Date**_{% newline %}
|General Company Data 
{% newline %}
{% fori attachement in custom.attachements_0_1 %}
| {% input attachement.file as:file_collection %}
| {% input attachement.description placeholder:"Description" %}
| {{ attachement.0_1.updated_by.name }}
| {{ attachement.0_1.updated_at | date:"%d/%m/%Y %H:%M" }}
|{% newline %}
{% endfori %}
{% endstripnewlines %}
<hr>

{% stripnewlines %}
{{header}}{% newline %}
|_**File**_|_**Notes**_|__|_**Description**_|_**Initials**_|_**Date**_|__{% newline %}
| ME 05/01| {% input custom.note.1_1 as:boolean %}| {%newline%}{%newline%}
{{headercontent}}{%newline%}
{% fori attachement in custom.attachements_1_1 %}
| {% input attachement.file as:file_collection %}
| {% input attachement.description placeholder:"Description" %}
| {{ attachement.1_1.updated_by.name }}
| {{ attachement.1_1.updated_at | date:"%d/%m/%Y %H:%M" }}{% newline %}
{% endfori %}
{%if custom.note.1_1 == "true" %}
{% newline %}{% newline %}{{header_notes}}{% newline %}
|{% input custom.addnote.1_1 placeholder:"Add notes" %} 
{% endif%}
{% endstripnewlines %}

<hr>

{% stripnewlines %}
{{header}}{%newline%}
| ME 05/02| {% input custom.note.2_1 as:boolean %}|| {%newline%}{%newline%}
{{headercontent}}{%newline%}
{% fori attachement in custom.attachements_2_1 %}
| {% input attachement.file as:file_collection %}
| {% input attachement.description placeholder:"Description" %}
| {{ attachement.2_1.updated_by.name }}
| {{ attachement.2_1.updated_at | date:"%d/%m/%Y %H:%M" }}{% newline %}
{% endfori %}
{%if custom.note.2_1 == "true" %}
{% newline %}{% newline %}{{header_notes}}{% newline %}
|{% input custom.addnote.2_1 placeholder:"Add notes" %} 
{% endif%}
{% endstripnewlines %}

<hr>

Thanks,
Ugis

Hi @Ugis,

It’s not related to the locked or unlocked being of the period, but that there’s no data in your fori-loop. If there isn’t, your table will be indeed broken, because it’s only the table that’s being executed like this :

|--23%--|--45%--|--15%--|----+ 

however, there is an option to execute this table only when there’s data, or should I say, if there’s a first loop : from the moment there’s a loop in your collection, the table can and may be executed.

This can be done by an if forloop.first statement, just like this :


{% stripnewlines %}
{% fori attachement in custom.attachements_0_0 %}
{% if forloop.first %}
{{headercontent}}{% endif %}
{% newline %}
|{% input attachement.file_0_0 as:file_collection size:max %}
|{% if attachement.file_0_0.document != blank %}{% input attachement.description_0_0 placeholder:"Description" %}{% endif %} 
| {{ attachement.0_0.updated_by.name }}
| {{ attachement.0_0.updated_at | date:"%d/%m/%Y %H:%M" }}{% newline %}
{% endfori %}
{% endstripnewlines %} 

So your table has to be inside your fori-loop (instead of outside) and you let it execute only when there’s a first loop :

{% if forloop.first %}
{{headercontent}}{% endif %} 

Can you give it a try?

That did the trick.
Thanks a lot.:slightly_smiling_face: