Silverfin

The Silverfin Developer Hub

Welcome to the Silverfin developer hub. You'll find comprehensive guides and documentation to help you start working with Silverfin as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Input

The input tag is used to create input fields in Silverfin templating language.

We use an input tag to allow user entering information in an input field and store this information in a custom drop. Drops can be seen as a "database" and are used to access data from Silverfin.

To reference an item in a custom drop, you always need "a namespace" and "a key". A custom drop with namespace 'the_namespace', and key 'the_key', would look like this: {% input custom.the_namespace.the_key %}.

🚧

The namespace and key should be given logical names, i.e. custom.cost.value.

{% input custom.the_namespace.the_key %}
Output

As attribute

Internally the entered data will always be saved as a String and interpreted based on how it is used in the template. Thus, even when you enter data as a currency, it will be interpreted as a string.

To change the way the type of input field is defined, we use the "as attribute".

none

When not using the "as attribute", a standard string field is shown.

{% input custom.the_namespace.the_key %}
Output

text

When using the "as text", a standard string field is shown as a text field.

{% input custom.the_namespace.the_key as:text %}
Output

currency

When using the "as currency", a standard string field is shown as a numeric value with decimals.

{% input custom.amortisation.begin_value as:currency %}
Output

integer

When using the "as integer", a standard string field is shown as a numeric value without decimals.

{% input custom.actions.amount as:integer %}
Output

percentage

When using the "as percentage", a standard string field is shown as a percentage value.

{% input custom.actions.percentage as:percentage %}
Output

precision attribute

Defines the amount of decimals stored for percentage values

{% input custom.some.value1 as:percentage precision:10 %}
Output

strip_insignificant_zeros attribute

If you set "strip_insignificant_zeros:true", the final decimal zeros from a percentage value will be removed.

{% input custom.some.value1 as:percentage precision:10 %}

{% input custom.some.value2 as:percentage precision:10 strip_insignificant_zeros:true %}
Output

boolean

When using the "as boolean", a checkbox is created.

{% input custom.check.done as:boolean %} Check if done
Output

The variable will return true when the box is checked and false when the box is unchecked.

{{ custom.check.done }}
Output
true

date

When using the "as date", a standard string field is shown as a date.

{% input custom.asset.date_of_acquisisiton as:date %}
Output

file

Using file as a value for the as attribute gives the opportunity to upload and attachment or annex that can contain multiple files by clicking the paperclip icon.

{% input custom.the_namespace.the_key as:file %}
Output

count number of files:
{{ custom.some.thing.documents.size }}

Output (2 files added)

select

When using the "as select", a dropdown is created.

options attribute

The select value needs to be accompanied by the option attribute. The option attribute contains a list of possible options which are divided by a pipe |.

{% input custom.taxrate.dropdown as:select options:"6%|12%|21%" %}
Output

Printing the variable will output the value of the chosen option.

{% input custom.btw.dropdown as:select options:"6%|12%|21%" %}

{{ custom.btw.dropdown }}
Output

option_values attribute (optional)

Optionally the attribute option_values can be added. The value returned by the variable will in this case not be the options presented but the corresponding option value.

{% input custom.btw.dropdown as:select 
    options:"6%|12%|21%" option_values:"0.06|0.12|0.21" %}

{{ custom.btw.dropdown }}
Output

account_collection

Account collections are used to be able to pick accounts from a certain range of accounts.

range attribute

An account collection needs to be accompanied with a range attribute.

{% input custom.benefit_in_kind.range as:account_collection range:"6" %}
Output
Output (when clicking the hashtag)

On the right side, the accounts that are accessible are shown.
On the left side, the selected accounts are shown.

Ranges can be further refined by using comma's and/or double underscores. The comma's will select individual account ranges. For example:

{% input custom.benefit_in_kind.range as:account_collection range:"4,7" %}

This range will return all 4 and 7 accounts.

Using double underscore will select the entire range of accounts. For example:

{% input custom.benefit_in_kind.range as:account_collection range:"4__7" %}

This range will return all 4, 5, 6 and 7 accounts.

Default attribute

Another optional attribute is the default attribute. It can be used in combination with nearly any type of input tag and it shows a default value. Please refer to examples below.

currency

{% input custom.amortisation.value as:currency default:100 %}
Output

account_collection

{% input custom.benefit_in_kind.range as:account_collection 
    range:"6" default:"61" %}
Output (after clicking the hashtag)

The 60 value are shown on the left without having to drag and drop them.

overwriting standard value

When a standard value is overwritten, Silverfin marks the field with a yellow triangle in the left top corner of an input field.

{% input custom.amortisation.value as:currency default:100 %}

When a default value is overwritten with a new value (i.e. 200) a yellow triangle is shown.

Output

❗️

A default value is not, however, automatically saved in the database. Printing the variable will not show the default value!

Placeholder attribute

When creating an input field, a standard placeholder shown, is the last part of your variable name (e.g. the key). In this particular case it is value.

{% input custom.amortisation.value %}
Output

It is possible to change the placeholder with the placeholder attribute.

{% input custom.amortisation.value placeholder:"Amortisation value" %}
Output

Assign attribute

The assign attribute creates a local variable that will take over the value of the custom variable. If the custom variable is blank, the default value will be taken over.

{% input custom.taxrate.value as:select options:"6%|12%|21%" default:"21%" assign:taxrate %}

{{ taxrate }}
Output

Required attribute

The required attribute allows to change the input field from a regular one to mandatory field. In other words, by using required attribute you specify that the field must be filled out before submitting the form.

🚧

Please note that the required attribute has a direct impact on a reconciliation of a template.

In case there are mandatory fields that are not completed, template will be unreconciled and you will see a red triangle next to the name of a template.

**Name:** {% input custom.person.name required:true placeholder:"Name" %}
**Surname:** {% input custom.person.name required:true placeholder:"Surname" %}
Output

Updated 2 months ago

Input


The input tag is used to create input fields in Silverfin templating language.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.