As you have noticed, there’s an extra configuration box for account and reconciliation templates from the templates shop:
The purpose of this, is to let users overwrite certain local variables in the Silverfin template. Let me put it this way: it can let you set another account range, and even add a default range, for an account collection!
But how does that work? Because the code of the Silverfin template has to be made in a specific way in order to be able to work with the extra configuration box.
We’ll explain in this case, but keep in mind this is not for custom templates, but only for templates that are from the Silverfin template collection.
Let’s say we have this template:
made from this code:
{% stripnewlines %}
|----
|----:
{% newline %}
| {% t "Some category" %}
{% input custom.range.category as:account_collection range:"6,7" accounts_var:category %}
| {% $1+input custom.category.endvalue as:currency default:category.value %}
{% endstripnewlines %}
Total: {{ $1 | currency }}
Above is an example of a template that will not work with the extra configuration box. So what needs to change?
First, let’s change the account range (6,7) into something more specific. Let’s say “610,611,62”.
We’ll add some new code to the template, that takes the range into a local variable. We’ll add this in the beginning of our template:
{% assign range_category = range_category | default:"6,7" %}
which means the local variable will have the default value of “6,7” because the local variable is empty (unless we assign the local variable to something else first! Which is exactly what we are going to do with the extra configuration box later on).
We change this as well in the range code of the template:
{% input custom.range.category as:account_collection range:range_category default:default_category accounts_var:category %}
As you can see, the range is linked to the local var:
range:range_category
Also, we even added a default range:
default:default_category
So it’s linked to a local variable called default_category which is nothing (= empty or blank) so it does nothing. But the point of this is to be able to overwrite this as well, if we wish.
Now, we’ve changed the range as well as added a default range to the code that can be overwritten. How, is explained here:
So, if we want to change our selectable range as well as add a default range, we can add this in the extra configuration box:
Think of it as above code in the extra configuration box is “placed” at the beginning of your template. So the first 2 lines of our code, is this:
{% assign range_category = "610,611,62" %}
{% assign default_category = "611" %}
So:
{% assign range_category = “610,611,62” %}
means the local var range_category will be assigned to the value of “610,611,62”
So later in the code, we have this:
{% assign range_category = range_category | default:“6,7” %}
Meaning, the local var is not empty so it doesn’t take the default value of “6,7” but the assigned value of our first line of code “610,611,62”
Same goes for the default range:
{% assign default_category = “611” %}
meaning the local var will actually have a value now that can be taken into account.
Do not be afraid to add a default range to the code, as it will not overwrite anything! As long as you have selected accounts (before changing the configuration of the Silverfin template through the extra configuration box) first, it will take that value of those accounts and keep it.
Good to mention not all Silverfin template are configurable just yet, but of course this is our goal to implement this for all Silverfin templates that could benefit from this.