Intermediate [Exercise 4: Account collection] (Training slides exercise)

Create an input field with a data type account_collection that allows selecting a range for all accounts in the trial balance beginning with 1 and 3 . Then create a table underneath that will show the account link and account value (with the numeric filter currency ) of the accounts selected. Using the variable created via accounts_var, display the total value of the accounts on the last row of the table with an upper border and in bold.

The final output should look like this:

Screenshot 2020-04-07 at 14.31.10

Solution:

{% input custom.exercise.accounts_to_select as:account_collection range:1,3 accounts_var:exercise_collection %}

{% stripnewlines %}
| Account name
| Account value
{% newline %}
|--------
|--------
{% newline %}
{% for account in exercise_collection %}
  | {{ account.link }}
  | {{ account.value | currency }}
  {% newline %}
{% endfor %}
|^ **Total** ^
|^ **{{ exercise_collection | currency }}** ^
{% endstripnewlines %}