# Customizable Filters

**URL:** <https://community.silverfin.com/t/customizable-filters/1858>\
**Category:** Templates\
**Created:** [August 4, 2020, 7:11pm UTC](https://community.silverfin.com/t/customizable-filters/1858 "2020-08-04T19:11:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Krause\_US](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/alexander_krause_us/32/950_2.png) [@Alexander\_Krause\_US](https://community.silverfin.com/u/Alexander_Krause_US)\
**Post date:** [August 4, 2020, 7:11pm UTC](https://community.silverfin.com/t/customizable-filters/1858/1 "2020-08-04T19:11:10Z")

</div>

Hi SF community!

I am trying to customize the filters being used upon printing a value in our templates to give the flexibility of adding decimals to printed numbers. In other words, we were hoping to have a case statement referring to a dropdown question asking “How many decimals do we want in the output of the number” and the number of decimals change according to the answer. My originally thought was printing: {{ number\_variable | currency\_dc:XXXX }} with XXXX = a variable from 1-5 depending on the case statement.

Is it possible to assign a variable to a filter? Or is there another efficient way to do this for a large set of numbers without writing lengthy IF statement code for each scenario?

Thanks!

---

<div class="post-metadata">

**Author:** ![Michiel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/michiel/32/2364_2.png) [@Michiel](https://community.silverfin.com/u/Michiel)\
**Post date:** [August 6, 2020, 7:53am UTC](https://community.silverfin.com/t/customizable-filters/1858/2 "2020-08-06T07:53:48Z")

</div>

Hi Alexander,

Welcome to the silverfin community!

It is possible to make the XXXX variable. Consider the following code:

```auto
{% assign amount = 5.10005 %}

{% assign number_of_decimals = 1 %}

{{ amount | currency_dc:number_of_decimals }}

```

In this case the output is 5.1.

Regards,

Michiel

---

<div class="post-metadata">

**Author:** ![Alexander\_Krause\_US](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/alexander_krause_us/32/950_2.png) [@Alexander\_Krause\_US](https://community.silverfin.com/u/Alexander_Krause_US)\
**Post date:** [August 6, 2020, 12:40pm UTC](https://community.silverfin.com/t/customizable-filters/1858/3 "2020-08-06T12:40:07Z")

</div>

Michiel,

This was perfect - thank you for the solution! Works perfectly.

Alex Krause

---

<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:** [August 10, 2020, 9:15am UTC](https://community.silverfin.com/t/customizable-filters/1858/4 "2020-08-10T09:15:07Z")

</div>

Closed on August 10, 2020, 9:15am UTC


