# CASE: allow\_false

**URL:** <https://community.silverfin.com/t/case-allow-false/2269>\
**Category:** Cases\
**Created:** [April 7, 2022, 9:52am UTC](https://community.silverfin.com/t/case-allow-false/2269 "2022-04-07T09:52:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kalpna\_Dhokia](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/kalpna_dhokia/32/1840_2.png) [@Kalpna\_Dhokia](https://community.silverfin.com/u/Kalpna_Dhokia)\
**Post date:** [April 7, 2022, 9:52am UTC](https://community.silverfin.com/t/case-allow-false/2269/1 "2022-04-07T09:52:17Z")

</div>

The purpose of this case is to demonstrate the filter “allow\_false.” This is useful where we have assignments with default values, where we do not always want the default property to come into action.

There are often configurations within templates where we have an assignment which is specific at firm level. If we want the configurable variable to be equal to false - this will mean that by default, we don’t want something to happen in the template.

Case 1 displays the issues faced where previously assigned variables will always display as the default value and Case 2 will show us how the allow\_false filter can overcome this.

In the example below, we will demonstrate how by default, we will display the gross profit percentage.

**Case 1 - No filter**

We initially would assign our variable to false, we can then see how this is displayed via the screenshots below.

```auto
{% assign display_option_gross_profit_percentage = false %}

Output display: {{ display_option_gross_profit_percentage }}

```

![Screenshot 2022-04-07 at 09.49.31](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/2X/e/e991cec50fba4681770d3023ae6d124e4c8822bd.png)

We can then assign the variable to itself with a default of true as seen below. In this instance, if the variable is falsy i.e. nil, false or empty, the default will come into play.

The problem we face with this syntax, is that the initial assignment, regardless of whether it is assigned as false, will always be true because of the default property of true.

```auto
{% assign display_option_gross_profit_percentage = false %}

Output display: {{ display_option_gross_profit_percentage }}

{% assign display_option_gross_profit_percentage = display_option_gross_profit_percentage | default:true %}

Output display: {{ display_option_gross_profit_percentage }}

```

![Screenshot 2022-04-07 at 09.56.54](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/2X/f/f626035918240dcae06341e7fe5e24b4b2616c43.png)

**Case 2 - With filter**

We begin here in the exact same way as case 1, where we assign our variable to false.

Whenever we assign our variable to false, we can then use the allow\_false filter as demonstrated below, which then allows us to use the configuration set to false, and the default property would _not_ come into action here.

To enable this filter, we use: allow\_false:true

Remember to add a comma (,) in between the default and allow\_false filter, else this will stop your syntax working the way it should.

```auto
{% assign display_option_gross_profit_percentage = false %}

Output display: {{ display_option_gross_profit_percentage }} 

{% assign display_option_gross_profit_percentage = display_option_gross_profit_percentage | default:true, allow_false:true %}

Output display: {{ display_option_gross_profit_percentage }}

```

![Screenshot 2022-04-07 at 10.13.36](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/2X/6/620dcc0fa7727692151eadbb23ba19a5d2e06cca.png)
