# CASE: display values of an object from a collection on one singular line

**URL:** <https://community.silverfin.com/t/case-display-values-of-an-object-from-a-collection-on-one-singular-line/397>\
**Category:** Cases\
**Tags:** case, iterations, for\_loop\
**Created:** [September 13, 2017, 12:42pm UTC](https://community.silverfin.com/t/case-display-values-of-an-object-from-a-collection-on-one-singular-line/397 "2017-09-13T12:42:22Z")\
**Posts on this page:** 1\
**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:** [September 13, 2017, 12:42pm UTC](https://community.silverfin.com/t/case-display-values-of-an-object-from-a-collection-on-one-singular-line/397/1 "2017-09-13T12:42:22Z")

</div>

Got the question just today: I don’t want to list all the directors in my text template. I would rather display them in one singular sentence, like “Tim, Joris, Sven”

Is this possible? Yes it is

If you take this code :

```auto
{% for person in period.directors %}
{{ person.name }}
{% endfor %}

```

it will result in this :

![35](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/2e26f40c419451780f2f964b39aceebcc37aae58.png)

With the stripnewlines attribute we can strip all these lines, and put them in one sentence.  
Just place the attribute before and after your code to do that :

```auto
{% stripnewlines %}
{% for person in period.directors %}
{{ person.name }},  
{% endfor %}
{% endstripnewlines %}

```

And the result will be like this :

![51](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/d8f5fd4e0863777a552b4aa7e5e19ac3ccc0a455.png)

Jack it up a little bit with a sentence and to end with an ‘and’ :

```auto
The directors of the company are: 
{% for person in period.directors %}
  {% if forloop.last %}
    and
  {% else %}
      {% unless forloop.first %}
        ,
      {% endunless %}
  {% endif %}
  {{ person.name }}
{% endfor %}
{% endstripnewlines %}

```

to look like this :

![38](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/5c05887e309ebc8c2d102b7e33415398522b4810.png)

Credits to @SamVanEenoo for this too 👍
