CASE: where attribute

You can now use a where filter, which should make things easier for cases like this for example:

Source code of above example:

{% comment %}create options for dropdown shares{% endcomment %}
{% assign types = "VG|BE|NE" %}

{% comment %}Collection of shares{% endcomment %}
{% stripnewlines %}
| Type of shares
| Amount of shares
{% newline %}
|--------
|--------:
  {% fori share in custom.shares %}
    {% newline %}
    | {% input share.type as:select options:types %}
    | {% $0+input share.amount as:currency %}
    |
    {% if forloop.last %}
      {% newline %}
      | 
      |_^ **{{ $0 | currency }}** ^_
    {% endif %}
  {% endfori %}
{% endstripnewlines %}

<p></p>

{% comment %}create option to select a value so it can be filtered upon{% endcomment %}
{% ic %}{::infotext}
{% t "Please select a value:" %} {% input custom.select.type as:select options:types %}
{:/infotext}{% endic %}

<p></p>

{% comment %}
------------------------------------------------------------------
View the total amount of the selected value with the WHERE filter
------------------------------------------------------------------
{% endcomment %}

{% comment %}create variable for the selected value from the dropdown{% endcomment %}
{% assign type_share = custom.select.type %}
{% comment %}create a collection that will be making use of the WHERE filter: the first part is the name of the database variable, the second {% endcomment %}
{% assign shares = custom.shares | where:"type",type_share %}
{% comment %}loop over newly made collection to get total result{% endcomment %}
{% for share in shares %}
  {% $1+ share.amount %}
{% endfor %}

{% t "The total amount for type share" %} *{{ type_share }}* is: **_{{ $1 | currency }}_**