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

**URL:** <https://community.silverfin.com/t/intermediate-exercise-4-account-collection-training-slides-exercise/1743>\
**Category:** Exercises\
**Tags:** training, input, account-collection, forloop\
**Created:** [April 7, 2020, 1:32pm UTC](https://community.silverfin.com/t/intermediate-exercise-4-account-collection-training-slides-exercise/1743 "2020-04-07T13:32:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![borjaGonzalez](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/borjagonzalez/32/825_2.png) [@borjaGonzalez](https://community.silverfin.com/u/borjaGonzalez)\
**Post date:** [April 7, 2020, 1:32pm UTC](https://community.silverfin.com/t/intermediate-exercise-4-account-collection-training-slides-exercise/1743/1 "2020-04-07T13:32:45Z")

</div>

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](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/2X/1/17229f34a8e1af34d2012ec8eb3e5d1bdc5e30cd.png)

---

<div class="post-metadata">

**Author:** ![borjaGonzalez](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/borjagonzalez/32/825_2.png) [@borjaGonzalez](https://community.silverfin.com/u/borjaGonzalez)\
**Post date:** [April 7, 2020, 1:33pm UTC](https://community.silverfin.com/t/intermediate-exercise-4-account-collection-training-slides-exercise/1743/2 "2020-04-07T13:33:25Z")

</div>

Solution:

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

```

Solution using HTML Tables:

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

<table class="">
  <thead>
    <tr>
      <th class="usr-line-bottom"><b>Account name</b></th>
      <th class="usr-line-bottom"><b>Account value</b></th>
    </tr>
  </thead>
  <tbody>
    {% for account in exercise_collection %}
      <tr>
        <td class="">{{ account.link }}</td>
        <td class="">{{ account.value | currency }}</td>
      </tr>
    {% endfor %}
    <tr>
      <td class="usr-line-top"><b>Total</b></td>
      <td class="usr-line-top"><b>{{ exercise_collection | currency }}</b></td>
    </tr>
  </tbody>
</table>

```
