IFI statement

Video outline

Definition

An ifi statement is an if statement that is always true in input view and depends on the condition that is defined in export view.

Difference between input and export view

Let me first start explaining what the difference is between input and export view. Input view is the screen where you are working in in Silverfin where you can input all data you need. You also see here infotexts, hashtags where you can add accounts to, guidance why something seems incorrect etc.

In the preview mode you can already get an idea of what the export will look like. You can access this via actions > preview. To have a look at the actual export you will have to navigate to Export (top navigation bar) and create a PDF for your client. As you will see this does not contain the hashtag symbols, the infotext and anything else that is not relevant for your client.

How to build an ifi-statement

Logic syntax is always written between brackets with percentage symbols: {% your_logic_syntax %}.
The ifi-statement needs to be opened and closed and needs to contain a condition.

All of the code that is inside the ifi statement will only be executed in export view when the condition is fulfilled. The code inside the tag will always be executed in input view.

Similar to the if statement the ifi statement can also be combined with the elsif and the else tags.

Usecase

A common usecase for ifi statements is to hide zero lines in export. Let’s take a closer look at this example.

{% stripnewlines %}
|---85%-----
|---15%-----:+
{% newline %}
| 
| _{{ period.year_end_date | date:"%Y" }}_
{% newline %}
| Costs goods type A
| {{ period.accounts.610__613 | currency }}
{% newline %}
| Costs goods type B
| {{ period.accounts.614 | currency }}
{% newline %}
| Costs goods type C
| {{ period.accounts.615 | currency }}
{% newline %}
| Costs goods type D
| {{ period.accounts.616 | currency }}
{% newline %}
{% endstripnewlines %}

I have a table here for which I want to always show all the lines in input view so the user can clearly see which lines are zero. However when creating an export for the client we don’t want to include the lines with value zero.

How can we achieve this in the code? We’re going to add an ifi statement around the code for each row that checks if the value on that row is zero or not. When it is not zero we want the line to be visible in export view, so the condition in the ifi statement is when the value is not zero. Only then should the code be executed in export view.

{% stripnewlines %}
|---85%-----
|---15%-----:+
{% newline %}
| 
| _{{ period.year_end_date | date:"%Y" }}_
{% newline %}
{% ifi period.accounts.610__613 != 0 %}
  | Costs goods type A
  | {{ period.accounts.610__613 | currency }}
  {% newline %}
{% endifi %}
{% ifi period.accounts.614 != 0 %}
  | Costs goods type B
  | {{ period.accounts.614 | currency }}
  {% newline %}
{% endifi %}
{% ifi period.accounts.615 != 0 %}
  | Costs goods type C
  | {{ period.accounts.615 | currency }}
  {% newline %}
{% endifi %}
{% ifi period.accounts.616 != 0 %}
  | Costs goods type D
  | {{ period.accounts.616 | currency }}
  {% newline %}
{% endifi %}
{% endstripnewlines %}