CASE: how to display details of an account in a text template?

This was the question last week during our event. And it’s a good question also.

Let’s say you make a text template “cover letter” and you want to show the details you gave for the account 747004 :

These details were created by the template “Standaardtoelichting”, which uses following code :

{% fori detail in current_account.custom.details %}{% if forloop.first %}
|--------------25%-----------------|--------------------45%-----------|------10%------|-------20%--------:+{% endif %}
|{% input detail.custom.title placeholder:'titel' %}| {% ic %}{% input detail.custom.text as:text size:mini placeholder:'extra info' %}{% endic %}{% nic %}{{ detail.custom.text | multiline_table}}{% endnic %}|{% input detail.custom.doc as:file %}|{% if forloop.last %}{% endif %}{% if current_account.liability_or_income %}{% $0+input detail.custom.value as:n_currency placeholder:'waarde' %}{% else %}{% $0+input detail.custom.value as:currency placeholder:'waarde' %}{% endif %}{% ic %}{% if forloop.last %}
|               |   |    |**{% if current_account.liability_or_income %}{{ -1*$0 | currency }}{% else %}{{ $0 | currency }}{% endif %}**{% endif %}{% endic %}{% endfori %}

So, those details are in a drop that has been created, and is called current_account.custom.details. So the account 747004 (here it’s our ‘current_account’) has that drop ‘custom.details’, with all those variables in it for a certain period.
All those variables are like :

  • detail.custom.title
  • detail.custom.text
  • detail.custom.value

How to show those now in a text template?

Firstly, we need to assign that current_account to something in our text template. Otherwise, we can’t know what account the current_account is.

{% assign current_account = #747004 %}

By doing this, we can show everything of the custom.details that are attached to that current_account.

Here is the complete code :

{% assign current_account = #747004 %}

<br>

|----------30%------------|---------------50%-----------|---------------:+{% for detail in current_account.custom.details %}
| {{ detail.custom.title }} | {{ detail.custom.text }}  | {{ detail.custom.value }} 
{% endfor %}

Which gives this result in an text template :

1 Like

Hi Sven, this was great. So am I correct with this code?

In the template ‘Kapitaal’, there are multiple custom drops. The one I’m interested in, is called ‘custom.toevoegingen’. The code here is

| {% t “Bedrag” %}| {% t “Datum” %} | {% t “Oorsprong” %} | # {% t “aandelen” %} | | {% t “Volgnr” %} | {% t “Saldo na vermindering” %} | {% t “Saldo aandelen na vermindering” %}
|:----12%—|-------|-----------|-----------:|-----------|--------|----------------------:|----------------------------:+{% fori detail in custom.toevoegingen %}
{% stripnewlines %}
{% capture min_var %}min_{{forloop.index}}{% endcapture %}
{% capture min_var_aandelen %}min_aandelen_{{forloop.index}}{% endcapture %}
{% capture oorsprong_var %}oorsprong_{{ detail.oorsprong }}{% endcapture %}

| {%$10+input detail.bedrag as:n_currency %}
| {% input detail.datum as:date%}
| {% input detail.oorsprong as:select options:oorsprong_types option_values:oorsprong_options %}
| {% input detail.aandelen %}

and so forth … So I thought this code was correct, but it isn’t working …

{% assign current_account = #100000 %}

{% for detail in current_account.toevoegingen %}
{{ detail.custom.bedrag }}
{{ detail.custom.datum }}
{{ detail.custom.oorsprong }}
{% endfor %}

Thanks!

Sorry, my code was (my mistake)

{% for detail in current_account.toevoegingen %}
{{ detail.bedrag }}
{{ detail.datum }}
{{ detail.oorsprong }}
{% endfor %}

Hi @Bart_Verhaeghe,

This is a little more tricky, because the details of the account template “Geplaatst kapitaal” are not saved in the current_account.details but in regular custom collections.

Almost all the account templates have their details saved in details while being “attached” to the current_account, except for the first made templates by Silverfin.

To get to those details that are saved in a custom collection, you’ll have to do this :

{% assign current_account = #100000 | first %}

By doing this, you’ll be able to get the details of that specific account (the first you’ll get in the range of 100000; if you wouldn’t add it, Silverfin doesn’t know where to look because an account 1000000 can also exist).

Now, you’re able to get to the details of any custom collection in the details of an account , for instance:

{% for detail in current_account.custom.toevoegingen %}
  {{ detail.datum }} 
{% endfor %}

Let us know if it works :wink:

HI Sven,

This works … Thanks!

Hi there, a small problem,

In the way you described, I can look up all data in the details except for detail.volgnr;

{% for detail in current_account.custom.toevoegingen %}
{{ detail.volgnr }}
{% endfor %}

doesn’t give anything … what am I doing wrong here?

Hey @Bart_Verhaeghe,

Can you post the whole code? Because the assign part is pretty important.

Thnx

Hi Sven, found a solution in the meantime. Thanks!