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

Variables

The variable tag is used to create new variables and values.

Assign

Assign tag is used to assign a value to a variable.
When you assign a value to a variable, you will create a string.

{% assign profit = 100 %}

{{ profit }}
Output
100

Capture

With this function you capture the string inside of the opening and closing tags and assigns it to a variable. Variables that you create using capture are stored as strings.

{% assign profit = 100 %}
{% capture profit_sentence %}
  Your profit is {{ profit }}.
{% endcapture %}

{{ profit_sentence }}
Output
Your profit is 100.

Register

Registers are used to store numbers and / or result of a calculation. This allows you to print the value or start some further calculations with the register.

Registers are local variables with some unique characteristics. Registers are created by using a dollar sign $ with a number from 0 to 39.

registers

📘

Let's assume that revenue is 200.
Let's assume that cost is -100.

We want to add up two values, revenue and cost. Therefore, we store both values in 1 register ($0). By printing $0, we automatically see the value the register contains.

{% $0+ revenue %}
{% $0+ cost %}

{{ $0 }}
Output
100.0

It is possible to show the variables that were added by putting an equal sign.

Revenue: {% =$0+ revenue %}
Cost: {% =$0+ cost %}

Profit: {{ $0 }}
Output
Revenue: 200.00
Cost: -100.00

Profit: 100.0

registers with input

Register can be used in combination with an input tag.

{% $0+input custom.asset.value %}

{{ $0 }}
Output

Updated about a month ago

Variables


The variable tag is used to create new variables and values.

Suggested Edits are limited on API Reference Pages

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