Input

With inputs tags you can create input fields in the Silverfin templating language.

Input tags allow users to enter information in an input field and stores 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

The inputted data will always be saved as a String in the database 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, you use the as attribute.

AttributeDescription
noneNo attribute is specified, standard string field.
textStandard string field as a text input.
currencyNumeric value with decimals. Accepts invert as additional attribute.
integerNumeric value without decimals. Rounds to the nearest whole number.
percentagePercentage value. Accepts precision and strip_insignificant_zeros as additional attribute.
booleanCheckbox with values blank, true or false.
dateDate picker that stores the date as a string. Accepts format as additional attribute.
filePaperclip to attach one or multiple files. Accepts max_size as additional attribute.
document.linkA link for all attached document(s) that will take you to the 'document preview' page.
selectDropdown input. Needs the options attribute. Also accepts option_values
account_collectionHashtag that allows you to select accounts from a certain range. Needs the range attribute. Also accepts the accounts_var attribute.

none

When you're not using the as attribute, you get a standard string field.

{% input custom.the_namespace.the_key %}
Output

text

Use the "as:text" attribute to show a standard string field as a text field.

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

currency

Use the "as:currency" attribute to show a standard string field as a numeric value with decimals.

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

invert

If you want to store a currency in the database with the opposite sign of what has been inputted, you can add the invert attribute.
Check out this case on Community for a practical implementation.

{% input custom.amortisation.begin_value as:currency,invert:true assign:amortisation_begin_value %}
{{ amortisation_begin_value | currency }}
Output

integer

Use the "as:integer" attribute to show a standard string field as a numeric value without decimals.

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

percentage

Use the "as:percentage" attribute to show a standard string field as a percentage value.

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

precision attribute

Defines the amount of decimals stored for percentage or currency 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

Use the "as:boolean" attribute to create a checkbox.

{% 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.
If the input hasn't been touched, regardless of the default value, the variable will return blank.

{{ custom.check.done }}
Output
true

date

Use the "as:date" attribute to show a standard string field as a date.

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

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

Use the "as:file" attribute to give the opportunity to upload an attachment or annex that can contain multiple files by clicking the paperclip icon.

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

max_size attribute

This attribute 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 %}
Output (1 file added)

document attribute

Adding '.document' when printing the value of a custom, will show the name of the (first) attached document.

{% input custom.some.thing as:file %}
{{ custom.some.thing.document }}
Output (1 file added)

documents attribute

Adding '.documents' when printing the value of a custom, will show the names of all the attached documents.

{% input custom.some.thing as:file %}
{{ custom.some.thing.documents  }}
Output (3 files added)

size attribute

Count the number of files attached.

{{ custom.some.thing.documents.size }}
Output

document link

In our database, in addition to accessing the document.name, you can also access the document.link for all attached documents. Clicking on the link of the document(s) will take you to the 'document preview' page. It's important to note that document.link essentially provides the same functionality as the preview view, but within the input view.

Below, you can find an example:

Add your attachment here: {% input custom.some.files as:file %}

{% for doc in custom.some.files.documents %}
  Name: {{ doc.file_name }}
  Link: {{ doc.link }}
{% endfor %}
Output of the template (3 files added)
Output of the export view (3 files added)

select

Use the "as:select" attribute to create a dropdown.

options attribute

The select attribute 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 (recommended)

We recommend adding the attribute option_values. The value returned by the variable will in this case not be the options presented, but rather 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

With account collections you are able to select accounts from a certain range of accounts.

range attribute

An account collection always needs the range attribute.

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

On the right side you see the available accounts.
On the left side you see the selected accounts.

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 can only be used inside an input tag of the type accounts_collection, and it is useful to assign the accounts selected in that 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 doing this:

{% input custom.drop.acc as:account_collection range:1 %}
{% assign acounts_assigned = period.accounts | range:custom.drop.acc %}

🚧

Other methods can't be considered

It is important to mention that 'accounts_var' works as a simple way of assigning the accounts of the current period to a variable. It cannot be combined with other methods on the accounts drop, such as 'include_zeros' or 'minus_1y' on the period.
In any other situation rather than the example shown above, you 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. You can use it in combination with nearly any type of input tag to display a default value. Here are some examples:

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 accounts beginning with "61" are shown on the left without having to select them.

overwriting default values

When you overwrite a default value, Silverfin marks the field with a yellow triangle in the left top corner of the input field.

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

❗️

A default value is not, however, saved in the database. Printing the custom will not show the default value! Check out this case for an example of how to refer to custom variables with defaults.

Placeholder attribute

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

{% input custom.amortisation.value %}
Output

You can change the placeholder with the placeholder attribute.

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

It's good practice to always define a placeholder.

Assign attribute

The assign attribute creates a local variable that contains the value of the custom variable. If the custom variable is blank, and a default has been defined, then the local variable will take the default value.

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

{{ taxrate }}
Output

Required attribute

The required attribute allows you to make the input field mandatory. In other words, by using the 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 the reconciliation of a template.

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

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

Read more on this topic in this case on the Community.

Import title attribute

By default, inside a custom 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 shown 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 in this community case

The import_title attribute can also be used on the name of the custom collection.