CASE: display account details even when the account value is zero

Let’s say we want to populate the name, number and value of a particular set of accounts as in the example below:

{% stripnewlines %}
|{% input custom.account.selection as:account_collection range:'1' %}
{% assign my_accounts = period.accounts | range:custom.account.selection  %}
|Account
|Value
{% newline %}
|---5%---
|---35%---
|---20%---
{% newline %}
{% for account in my_accounts %}
|
|{{ account.link }}
|{{ account.value | currency }}
{% newline %}
{% endfor %}
{% endstripnewlines %}

The problem here is that even though we have selected three accounts, only one is showing on the table and this is because it’s the only one with a value in our Trial Balance . If we want, however, to be able to display also the accounts that have a zero value, we have to add .include_zeros to our account drop as in the code below:

{% stripnewlines %}
|{% input custom.account.selection as:account_collection range:'1' %}
{% assign my_accounts = period.accounts.include_zeros | range:custom.account.selection  %}
|Account
|Value
{% newline %}
|---5%---
|---35%---
|---20%---
{% newline %}
{% for account in my_accounts %}
|
|{{ account.link }}
|{{ account.value | currency }}
{% newline %}
{% endfor %}
{% endstripnewlines %}

This way all accounts selected will now display regardless their value:

image

1 Like