Input
The input tag is used to create input fields in Silverfin templating language.
We use an input tag to allow users to enter information in an input field and to 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 %}

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 data type of the input field, we use the as
attribute.
none
When not using the as
attribute, a standard string field is shown.
{% input custom.the_namespace.the_key %}

text
When using the "as text", a standard string field is shown as a text field.
{% input custom.the_namespace.the_key as:text %}

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

integer
When using the "as integer", a standard string field is shown as a numeric value without decimals.
{% input custom.actions.amount as:integer %}

percentage
When using the "as percentage", a standard string field is shown as a percentage value.
{% input custom.actions.percentage as:percentage %}

precision attribute
Defines the amount of decimals stored for percentage values
{% input custom.some.value1 as:percentage precision:10 %}

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

boolean
When using the "as boolean", a checkbox is created.
{% input custom.check.done as:boolean %} Check if done

The variable will return true
when the box is checked and false
when the box is unchecked.
{{ custom.check.done }}
date
When using the "as date", a standard string field is shown as a date.
{% input custom.asset.date_of_acquisisiton as:date %}

date format
Customize how the date is displayed inside the input field using the 'format' attribute. In the 'Date and Time' section there is a list of useful format types that can be applied.
{% input custom.asset.date_of_acquisisiton as:date format:'%Y' %}
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 %}

size attribute
Count the number of files attached.
{{ custom.some.thing.documents.size }}

max_size attribute
It will limit the user to add attachments that exceed the specified maximum in MB.
Silverfin uses the 1kB = 1000 bytes convention
{% input custom.some.thing as:file max_size:2 %}

document attribute
It will show the name of the (first) attached document.
{% input custom.some.thing as:file %}
{{ custom.some.thing.document }}

documents attribute
It will return a list with the names of every selected files.
{% input custom.some.thing as:file %}
{{ custom.some.thing.documents }}

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

Printing the variable will output the value of the chosen option.
{% input custom.btw.dropdown as:select options:"6%|12%|21%" %}
{{ custom.btw.dropdown }}

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

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


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.
accounts_var attribute (optional)
This attribute could be used inside an input tag of the type accounts_collection only, and it is useful to assign the accounts selected in the input to the variable name that is defined.
{% input custom.drop.acc as:account_collection range:1 accounts_var:accounts_selected %}
Using the previous syntax is equivalent to having this:
{% input custom.drop.acc as:account_collection range:1 %}
{% assign acounts_assigned = period.accounts | range:custom.drop.acc %}
Other attributes or filters won't be considered
It is important to mention that 'accounts_var' works as a simple way of assigning the accounts to a variable. It cannot be combined with more complex assignments, where we could need to include a 'default' selection in the input, or filters like 'include_zeros' or 'minus_1y' for the period or accounts drops.
In any other situation rather than the example shown above, we should avoid using the 'accounts_var' attribute and create the variable using the 'assign' tag in a following step.
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 %}

account_collection
{% input custom.benefit_in_kind.range as:account_collection
range:"6" default:"61" %}

The accounts beginning with "61" 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.

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, the last part of your variable name (e.g. the key) is shown as a placeholder. In this particular case, it is value.
{% input custom.amortisation.value %}

It is possible to change the placeholder with the placeholder
attribute.
{% input custom.amortisation.value placeholder:"Amortisation value" %}

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

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

Import title attribute
By default, inside a collection, the name of the input field shown when using the "import reconciliation data" action is the "key" on the variable name (or the "placeholder" if there is one). The import_title
attribute allows you to override this behaviour and customize the title in the import screen.
This attribute can only be applied in input fields inside a fori loop as the "import reconciliation data" action only works for custom collections.
Liquid code:
{% fori employee in custom.employees %}
{% input employee.name %}
{% input employee.date_of_birth as:date placeholder:'dd/mm/yyyy' import_title:'Date of birth' %}
{% endfori %}
Import reconciliation data screen:


You can find more information regarding the titles in the import reconciliation data on this community case
Updated 4 months ago