CASE: make header with additional info in a recon template

Within a recon template, you can make a beautiful header with contains some additional info that might come in handy for the user(s) that need to use the recon template.
It could also be used to distinguish your custom templates from others as well.

An example:

In order to achieve this, you need to create your table first (to make the code more readable, we’ll try to put the code between stripnewlines as much as possible - see more info here ).


{% comment %}
Below code gives a header with an automatically check for an user to check-off, that will impact the reconciliation as well
{% endcomment %}

{% stripnewlines %}
| 
|
|
|
{% newline %}
|----15%----:
|----35%----
|----15%----:
|----35%----+#
{% newline %}
| {% t "Name client" %}
| {{ company.name | upcase }}
| {% t "Period working papers" %}
| {{ period.end_date | date:"%d-%m-%Y" }}
{% newline %}
| {% t "Prepared by:" %}  
  {% input custom.prepared.check as:boolean %}
  {% if custom.prepared.check == "true" %}
    {% assign check_prep = 0 %}
  {% else %}
    {% assign check_prep = 1 %}
  {% endif %}
| {% unreconciled check_prep as:indicator  %}
  {{ custom.prepared.check.updated_by.name  }}
| {% t "Prepared on:" %}
| {{ custom.prepared.check.updated_at | date:"%d/%m/%Y"  }}
{% newline %}
| {% t "Review by:" %}  
  {% input custom.review.check as:boolean %}
  {% if custom.review.check == "true" %}
    {% assign check_review = 0 %}
  {% else %}
    {% assign check_review = 1 %}
  {% endif %}
| {% unreconciled check_review as:indicator  %}
  {{ custom.review.check.updated_by.name  }}
| {% t "Review on:" %}
| {{ custom.review.check.updated_at | date:"%d/%m/%Y"  }}
{% endstripnewlines %}

Let’s look at how such is created:

Create table


{% stripnewlines %}
| 
|
|
|
{% newline %}
|----15%----:
|----35%----
|----15%----:
|----35%----+#
{% endstripnewlines %}

The first part is actually creating an empty header:

{% stripnewlines %}
| 
|
|
| 

The second part is defining how your table needs to be (how width, right alligned or not, …) :

{% newline %}
|----15%----:
|----35%----
|----15%----:
|----35%----+# 

Here, we decide to have 4 columns spread over the total width of your page; that’s what the + does in your last column.
The hashtag is making sure we have borders for each cell in the header.
Each column has a defined width as well - make sure the sum of this isn’t more than 100%. Also, the second and fourth column is right alligned because they have a : at the end of each column. If you want to center those columns, use : at the left and right of the column.

If you wish to add an extra column, you’ll need to define that in both parts, like this (and be sure to check the total sum of the fixed width of each column!):


{% stripnewlines %}
| 
|
|
|
|
{% newline %}
|----15%----:
|----35%----
|----10%----:
|-----5%----
|----35%----+#
{% endstripnewlines %}

So above code creates a header; if you wish to add a new line in the header, you can do so by adding this code between stripnewlines for each new line:

{% newline %}
| {% t "Review by:" %}  
  {% input custom.review.check as:boolean %}
  {% if custom.review.check == "true" %}
    {% assign check_review = 0 %}
  {% else %}
    {% assign check_review = 1 %}
  {% endif %}
| {% unreconciled check_review as:indicator  %}
  {{ custom.review.check.updated_by.name  }}
| {% t "Review on:" %}
| {{ custom.review.check.updated_at | date:"%d/%m/%Y"  }}

The newline-tag is important! If this is not used, it’ll break your table. It gives a good view too on how your table is constructed.

:bulb: In this case we’ve added indicators as well, that need to be checked off in order to complete the reconciliation! It also gives the name and time of the user who last updated the check.

Great example of how to code in a neat and scalable way. This is THE way to produce great results (even in the short term). Thanks Sven!

1 Like

Is there a possibility to reset the value of the checkbox after unchecking for example ‘Prepared by’?
It seems that once clicked the checbox, the name (and date) stays visible after unchecking the checkbox.

Hi Tom,

Welcome to Silverfin Community. The following code should work:

{% input custom.check.prepared as:boolean %} Prepared by:

{% if custom.check.prepared == true %}{{ custom.check.prepared.updated_by.name}}{% endif %}

Any questions, please let us know.

Best,
Borja

Hi Borja,

That did the trick indeed!

Many tanks,
Tom