CASE: how Silverfin makes templates configurable

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:


Also, we even added a default range:


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" %}


{% 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.

1 Like

Thanks Sven, this was what I was looking for.

We currently have the following configuration variables for the taxed and tax exempt reserves:

{% assign range_1005 = "13" %}
{% assign default_1005 = "13" %}

range_1005 seems to set the available range for the legal reserves. However, default_1005 doesn’t set the default range. What would be the correct variable to set the default range?

Is our understanding correct that every account range would follow the following format: ‘range_code’?

Hi @mvanderstock,

Actually, no. It depends from template to template how these variables are called.
template A can have it coded like range_code while another template B has the name of the variable set on range_expenses for example.

Now, your configuration isn’t working as you actually need the variable def_range_1005 instead of default_1005.
So changing that should work.

Thank you, @sven

Considering the naming convention depends from template to template, do you have a list somewhere of all the configuration variables per template? Debug mode doesn’t seem to include these.

They are maintained on our help pages here, so I hope they are up-to-date there :crossed_fingers:

Nevertheless, if you encounter another such issue, you can always contact (it is the support team that maintains the documentation).
In an ideal world, the debug-mode would also show these variables in a different section. For the templates related to the BE market, we are steadily changing our open code to make that more visible; for paying templates where the code isn’t open, we have to maintain that separately on our help-pages.