Collection
Map
This filter will create an array of items taking from a collection using the given argument.
{{ period.accounts }} is a collection that holds all used accounts of the current period. When adding "613" to it, {{ period.accounts.613 }}, it'll filter down to all used accounts of the given range 613, with info like name, number, value, ...
{% assign used_accounts = period.accounts.613 | map:"number" | join:", " %}
{{ used_accounts }}
Range
This will filter an account collection on a specific range given as a argument. The range can be given as a string between double quotes "".
{% assign profit = period.accounts | range:"6,7" %}
{{ profit.value | currency }}
This will take all inputted years and only filter on the ones that have '2020' in them for that specific database variable 'custom.year'.
Group by
The group_by filter provides the possibility to group items of the collection that have the same value for a specific variable.
{% stripnewlines %}
|----|---|---# {% newline %}
{% fori share in custom.shares %}
| {% input share.name %}
| {% input share.type as:select options:"A|B|C" %}
| {% input share.value as:currency %}
{% newline %}
{% endfori %}
{% endstripnewlines %}
{% assign grouped_shares = custom.shares | group_by:"type" %}
B aandelen
{% for share in grouped_shares["B"] %}
{{ share.name }} {{ share.value }}
{% endfor %}
Let's assume that we filled in some data as shown below. Then the above code will give the following result:
You can find an example of the group_by filter on our community.
Index by
The index_by filter makes it possible to access a collection item through another index then you are used to.
The community provides a perfect example on how to implement this.
When 2 items of a collection have the same index, only the last item will be called upon when that index is used.
Where
Will create an array including only the objects that meet the established condition.
{% assign genders = "Female|Male|Other" %}
{% fori people in custom.people %}
|{% input people.name %}
|{% input people.gender | as:select | options:genders %}
{% endfori %}
{% assign women = custom.people | where:'gender','Female' %}
{% for woman in women %}
{% if forloop.last %}{% assign names = names | append:woman.name | append:"." %}
{% else %}
{% assign names = names | append:woman.name | append:", " %}
{% endif %}
{% endfor %}
Women: {{ names }}
Community case
For more examples of usage, please, refer to our Community case post
Analytical code
This filter maps the selected range of accounts for the specified dimension/company code.
{% for dimension in company.analytical_type_1_codes %}
{% assign accounts = period.accounts | analytical_code:dimension.code | range:"4" %}
{% for account in accounts %}
Dimension {{ dimension.code }} - {{ account.link }} {{ account.value }}
{% endfor %}
{% endfor %}
Dimension 001 - 400001 Sales = -1,000.00
Dimension 002 - 400001 Sales = -2,000.00
Dimension 003 - 400001 Sales = -3,000.00
Add rounding difference
The filter add_rounding_difference will remove decimals from every amount for every single trial balance account. The rounding difference will be allocated to the indicated BS and P&L account (Rounding configuration), so that the total trial balance balances back to 0.
You can find an example of the add_rounding_difference filter on our community.
Note that the core rounding functionality should be activated before this filter can be used.
Updated almost 2 years ago