<p>I wasn't able to understand how to apply your suggestions and went with this route:</p>

<pre><code>{% for coupon in craft.entries.section('coupons').limit('30').status('live').order('postDate asc') %}
    {% set image = coupon.contentBuilder.type('image').first() %}
       {# multiple times for each of the required fields #}
       {# here comes some other code related to field's value manipulations #}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2015-10-23T22:01:54.123Z
2015-10-23T22:01:54.123Z
Mark H.
<p>You'll have to build a list of the data and then display it.</p>

<pre><code>{% set arr = [] %}

{% for coupon in craft.entries.section('coupons').status('live').order('postDate asc') %}
    {% for content in coupon.contentBuilder %}
        {% set arr = arr|merge([content.myUniqueFieldName: content]) %}
    {% endfor %}
{% endfor %}

{% for item in arr %}
    {{ item.title }}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2015-10-22T16:17:30.837Z
Hey, it shows me this error - A hash key must be followed by a colon (:). Unexpected token "punctuation" of value "." ("punctuation" expected with value ":")   Also would you please explain this line - content.myUniqueFieldName: content   I'd like to get all the fields from matrix not just a single one. Should I ignore myUniqueFieldName ?
Mark H.
CC BY-SA 3.0
2015-10-24T08:56:37.047Z
Sorry, I fixed my code (I quickly bashed it out the other day while at work). I see you solved your problem anyway, well done.
Rick
CC BY-SA 3.0
2015-10-22T01:05:42.743Z
2015-10-24T08:55:58.843Z
2015-10-24T08:55:58.843Z
Rick
<p>I'm trying to list some entries from specific channel and get the access to matrix fields. The problem is that some of the entries are listed twice or even often. How do I remove the duplicates?</p>

<pre><code>    {% for coupon in craft.entries.section('coupons').status('live').order('postDate asc') %}
        {% for content in coupon.contentBuilder %}
        {% endfor %}
    {% endfor %}
</code></pre>

CC BY-SA 3.0
2015-10-22T07:25:19.400Z
The loop through `craft.entries.section('coupons')` should not list entries multiple times!
carlcs
<matrix>
List Entries and Matrix
# List Entries and Matrix

(Asked by: username_0 on 2015-10-21)

I'm trying to list some entries from specific channel and get the access to matrix fields. The problem is that some of the entries are listed twice or even often. How do I remove the duplicates?
    {% for coupon in craft.entries.section('coupons').status('live').order('postDate asc') %}
        {% for content in coupon.contentBuilder %}
        {% endfor %}
    {% endfor %}

**Tags:** matrix
> **Comments:**
> **username_1**: The loop through `craft.entries.section('coupons')` should not list entries multiple times!  

---

## 2 answers

### Answer by username_0 on 2015-10-23. Score: 1

I wasn't able to understand how to apply your suggestions and went with this route:
{% for coupon in craft.entries.section('coupons').limit('30').status('live').order('postDate asc') %}
    {% set image = coupon.contentBuilder.type('image').first() %}
       {# multiple times for each of the required fields #}
       {# here comes some other code related to field's value manipulations #}
{% endfor %}


---

### Answer by username_2 on 2015-10-22. Score: 1

You'll have to build a list of the data and then display it.
{% set arr = [] %}

{% for coupon in craft.entries.section('coupons').status('live').order('postDate asc') %}
    {% for content in coupon.contentBuilder %}
        {% set arr = arr|merge([content.myUniqueFieldName: content]) %}
    {% endfor %}
{% endfor %}

{% for item in arr %}
    {{ item.title }}
{% endfor %}

> **Comments:**
> **username_0**: Hey, it shows me this error - A hash key must be followed by a colon (:). Unexpected token "punctuation" of value "." ("punctuation" expected with value ":")   Also would you please explain this line - content.myUniqueFieldName: content   I'd like to get all the fields from matrix not just a single one. Should I ignore myUniqueFieldName ?  
> **username_2**: Sorry, I fixed my code (I quickly bashed it out the other day while at work). I see you solved your problem anyway, well done.  

---

