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 :