# CASE: create account collection with only starred accounts possible

**URL:** <https://community.silverfin.com/t/case-create-account-collection-with-only-starred-accounts-possible/1234>\
**Category:** Cases\
**Tags:** input, methods, use\_case\
**Created:** [October 8, 2018, 8:21am UTC](https://community.silverfin.com/t/case-create-account-collection-with-only-starred-accounts-possible/1234 "2018-10-08T08:21:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [October 8, 2018, 8:21am UTC](https://community.silverfin.com/t/case-create-account-collection-with-only-starred-accounts-possible/1234/1 "2018-10-08T08:21:05Z")

</div>

Let’s examine the code of a reconciliation template, which let you select a range of accounts that have certain details in it:

```auto
{% input custom.accounts.numbers_42 as:account_collection range:"4,17" accounts_var:accounts_42 %}

```

Perhaps we want to change the possibility to select all accounts in that range and change it in accounts in that range **that are starred**?

With the method **_.starred_** we can however:

> period.accounts.starred

This will actually give you all accounts in the current period that are starred.

Let’s change our code so it can give only starred accounts in a certain range:

```auto
{% comment %}create starred range for range 4 & 17{% endcomment %}
{% assign standard_range = "4,17" %}
{% assign starred_range = period.accounts[standard_range].starred | map:"number" | join:"," %}

{% input custom.accounts.numbers_42 as:account_collection range:starred_range accounts_var:accounts_42 %}

```

Let’s examine this:

> {% assign standard\_range = “4,17” %}  
> {% assign starred\_range = “” %}

We create 1 variable to filter later on the **_period.accounts_** drop

> {% assign starred\_range = period.accounts[standard\_range].starred | map:“number” | join:“,” %}

We loop over all accounts that are in the range of 4,17 and also are starred (you can read it like _period.accounts[“4,17”].starred_)

The **_map_** filter will take each element ( = number ) of the already filtered drop _period.accounts[standard\_range].starred_ and join each element with a “,” so we get something like this for instance:

**40000,41610,41620,420000,44000,44400,45000,45100,45200,48000,48200**

This string now can be used in our account collection:

> {% input custom.accounts.numbers\_42 as:account\_collection range: **starred\_range** accounts\_var:accounts\_42 %}

---

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [October 8, 2018, 8:53pm UTC](https://community.silverfin.com/t/case-create-account-collection-with-only-starred-accounts-possible/1234/2 "2018-10-08T20:53:13Z")

</div>

Updated the case with the much easier **map** filter: lesser, easier code is what we strive for! 👌
