# Advanced \[Exercise 1 & 2: Arrays, updated\_by & updated\_at\] (Training slides exercise)

**URL:** <https://community.silverfin.com/t/advanced-exercise-1-2-arrays-updated-by-updated-at-training-slides-exercise/1744>\
**Category:** Exercises\
**Tags:** exercises, training, array, advanced\
**Created:** [April 7, 2020, 4:34pm UTC](https://community.silverfin.com/t/advanced-exercise-1-2-arrays-updated-by-updated-at-training-slides-exercise/1744 "2020-04-07T16:34:46Z")\
**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, 4:34pm UTC](https://community.silverfin.com/t/advanced-exercise-1-2-arrays-updated-by-updated-at-training-slides-exercise/1744/1 "2020-04-07T16:34:46Z")

</div>

- Create a checklist with questions related to VAT declarations (this could be in an infotext e.g.)
- Several columns: checkbox, the question, option to comment
- Make sure if checkbox is not done, the template cannot get reconciled (show this with an indicator, which is a separate column)
- Add a tick box that will display the name of the user and the time it was checked.
- The checklist cannot be reconciled unless someone checks the template final
- The template should be locked once the review final boolean is ticked

 ![Screenshot 2020-04-07 at 17.54.24](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/2X/0/03f0396e3701eeb69cf467b2c9b91addb51799fd.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, 4:36pm UTC](https://community.silverfin.com/t/advanced-exercise-1-2-arrays-updated-by-updated-at-training-slides-exercise/1744/2 "2020-04-07T16:36:59Z")

</div>

Solution:

```auto
{% ic %}{::infotext}This overview is a checklist needed each period for VAT declaration{:/infotext}{% endic %}
{% assign question_array = "Did the customer send all purchase invoices?|Did the customer send all sale invoices?|Are all invoices booked?|Are all financial transactions booked?|Has the VAT declaration been filed?" | split:"|" %}
{% assign key_array = "purchase|sale|invoice|transaction|declaration" | split:"|" %}

{% stripnewlines %}
| Review final?
| Final check by:
| Final check on:
{% newline %}
|------
|------
|------#
{% newline %}
| {% input custom.final.check as:boolean assign:final_check %}
{% if custom.final.check == true %}
| {{ final_check.updated_by.name }}
| {{ final_check.updated_at | localized_date:"%d/%m/%y - %H:%M" }}
{% assign sf_show_inputs = false %}
{% endif %}
{% newline %}
{% endstripnewlines %}

{% stripnewlines %}
|
|
|
| Check
| Comment
{% newline %}
|---1%---
|---5%---
|---1%---:
|--------
|--50%-+
{% newline %}
{% assign no = 0 %}
{% for item in key_array %}
| {% if custom.bool.[item] != true %}{% unreconciled 1 as:indicator unreconciled_text:'Obligated' %}{% endif %}
| {% input custom.bool.[item] as:boolean %}
| {% assign no = no+1 %}
  {{ no | integer }}.
| {{ question_array[forloop.index0] }}
| {% input custom.check.[item] as:text default:item %}
{% newline %}
{% endfor %}
{% endstripnewlines %}

```

Solution using HTML Tables:

```auto
{% ic %}{::infotext}This overview is a checklist needed each period for VAT declaration{:/infotext}{% endic %}
{% assign question_array = "Did the customer send all purchase invoices?|Did the customer send all sale invoices?|Are all invoices booked?|Are all financial transactions booked?|Has the VAT declaration been filed?" | split:"|" %}
{% assign key_array = "purchase|sale|invoice|transaction|declaration" | split:"|" %}

<table class="usr-width-100 usr-bordered">
  <thead>
    <tr>
      <th class="">Review final?</th>
      <th class="">Final check by:</th>
      <th class="">Final check on:</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td class="">{% input custom.final.check as:boolean assign:final_check %}</td>
      {% if custom.final.check == true %}
        <td class="">{{ final_check.updated_by.name }}</td>
        <td class="">{{ final_check.updated_at | localized_date:"%d/%m/%y - %H:%M" }}</td>
        {% assign sf_show_inputs = false %}
      {% else %}
        <td class=""></td>
        <td class=""></td>
      {% endif %}
    </tr>
  </tbody>
</table>

<table class="usr-width-100">
  <thead>
    <tr>
      <th class="usr-width-1 usr-line-bottom"></th>
      <th class="usr-width-5 usr-line-bottom"></th>
      <th class="usr-width-1 usr-line-bottom"></th>
      <th class="usr-line-bottom"><b>Check</b></th>
      <th class="usr-width-50 usr-line-bottom"><b>Comment</b></th>
    </tr>
  </thead>
  <tbody>
    {% assign no = 0 %}
    {% for item in key_array %}
      <tr>
        <td class="">{% if custom.bool.[item] != true %}{% unreconciled 1 as:indicator unreconciled_text:'Obligated' %}{% endif %}</td>
        <td class="">{% input custom.bool.[item] as:boolean %}</td>
        <td class="">{% assign no = no+1 %}{{ no | integer }}.</td>
        <td class="">{{ question_array[forloop.index0] }}</td>
        <td class="">{% input custom.check.[item] as:text default:item %}</td>
      </tr>
    {% endfor %}
  </tbody>
</table>

```
