# Conditional output

**URL:** https://community.silverfin.com/t/conditional-output/786
**Category:** Exports
**Tags:** ifi, control\_flow
**Created:** [March 30, 2018, 7:40am UTC](https://community.silverfin.com/t/conditional-output/786 "2018-03-30T07:40:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Warde](https://avatars.discourse-cdn.com/v4/letter/w/5f9b8f/32.png) [@Warde](https://community.silverfin.com/u/Warde)
#### Post date: [March 30, 2018, 7:40am UTC](https://community.silverfin.com/t/conditional-output/786/1 "2018-03-30T07:40:01Z")

</div>

I have some input text that I always need, but in the output I like to show it depending on an input condition (boolean: Show text Y/N).

I can solve this by repeating the code: once with the {% ic %}-tag, once without it, in combination with the if-statement.

However, this means that all code needs to be doubled, something I rather like to avoid.

So I tried a workaround, see below.

{% input period.custom.berekeningniettonen.rc as:boolean %} Tekst niet mee opnemen in output?

{% assign niet\_tonen = period.custom.berekeningniettonen.rc %}

{% if niet\_tonen == true %}

{% capture tonen\_ic %}  
{% raw %}  
{% ic %}  
{% endraw %}  
{% endcapture tonen\_ic %}

{% else %}

{% capture tonen\_ic %} {% endcapture tonen\_ic %}

{% endif %}

{{ tonen\_ic }}

However, it seems the {% raw %} also works on the {% ic %} when I use {{ tonen\_ic }}, the {% ic %} code is not executed when I do like this…

Would there be another way to solve this?

Thanks.

Ward

---

<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: [April 2, 2018, 2:23pm UTC](https://community.silverfin.com/t/conditional-output/786/2 "2018-04-02T14:23:29Z")

</div>

Hello @Warde,

Couldn’t you get the needed result by using an ifi-statement on your boolean?

Like

```auto

{% ifi niet_tonen %}
This text will always be shown in input, and only in output when the boolean is checked
{% endifi %} 

```

The ifi-statement means: when the if-statement is fullfiled, then it’ll be displayed in output.

Care to try?

---

<div class="post-metadata">

### Author: ![Warde](https://avatars.discourse-cdn.com/v4/letter/w/5f9b8f/32.png) [@Warde](https://community.silverfin.com/u/Warde)
#### Post date: [April 3, 2018, 6:57am UTC](https://community.silverfin.com/t/conditional-output/786/3 "2018-04-03T06:57:08Z")

</div>

Right, forgot about this one, never used it before, thanks Sven!
