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

**URL:** https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275
**Category:** Cases
**Tags:** assign, case, for\_loop
**Created:** [May 24, 2017, 8:22am UTC](https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275 "2017-05-24T08:22:31Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)
#### Post date: [May 24, 2017, 8:22am UTC](https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275/1 "2017-05-24T08:22:31Z")

</div>

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 :

 ![](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/13ed0b5e238dfd17e9d05f5a52c4cccef84701ce.png)

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

```auto
{% 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.

```auto
{% 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 :

```auto
{% 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 :

 ![](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/3a8ff184d808f8185e33d97982ffc7b7de0b23dd.png)

---

<div class="post-metadata">

### Author: ![Bart\_Verhaeghe](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bart\_Verhaeghe](https://community.silverfin.com/u/Bart_Verhaeghe)
#### Post date: [February 2, 2018, 9:45am UTC](https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275/2 "2018-02-02T09:45:17Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![Bart\_Verhaeghe](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bart\_Verhaeghe](https://community.silverfin.com/u/Bart_Verhaeghe)
#### Post date: [February 2, 2018, 9:49am UTC](https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275/3 "2018-02-02T09:49:23Z")

</div>

Sorry, my code was (my mistake)

{% for detail in current\_account.toevoegingen %}  
{{ detail.bedrag }}  
{{ detail.datum }}  
{{ detail.oorsprong }}  
{% endfor %}

---

<div class="post-metadata">

### Author: ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)
#### Post date: [February 4, 2018, 9:55am UTC](https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275/4 "2018-02-04T09:55:35Z")

</div>

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 :

```auto
{% 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:

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

```

Let us know if it works 😉

---

<div class="post-metadata">

### Author: ![Bart\_Verhaeghe](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bart\_Verhaeghe](https://community.silverfin.com/u/Bart_Verhaeghe)
#### Post date: [February 6, 2018, 1:59pm UTC](https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275/5 "2018-02-06T13:59:51Z")

</div>

HI Sven,

This works … Thanks!

---

<div class="post-metadata">

### Author: ![Bart\_Verhaeghe](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bart\_Verhaeghe](https://community.silverfin.com/u/Bart_Verhaeghe)
#### Post date: [February 15, 2018, 4:09pm UTC](https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275/6 "2018-02-15T16:09:16Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)
#### Post date: [February 15, 2018, 4:15pm UTC](https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275/7 "2018-02-15T16:15:38Z")

</div>

Hey @Bart_Verhaeghe,

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

Thnx

---

<div class="post-metadata">

### Author: ![Bart\_Verhaeghe](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bart\_Verhaeghe](https://community.silverfin.com/u/Bart_Verhaeghe)
#### Post date: [February 19, 2018, 1:16pm UTC](https://community.silverfin.com/t/case-how-to-display-details-of-an-account-in-a-text-template/275/8 "2018-02-19T13:16:36Z")

</div>

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