<p>You are on the right track, to “collect” the entry IDs you have to use the <code>merge</code> filter in your Matrix loop though.</p>

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

{% for profile in highlightProfiles %}
    {% set ids = profile.hightlightProfileTeaser.ids() %}
    {% set highlightProfileSingleIds = highlightProfileSingleIds|merge(ids) %}
{% endfor %}
</code></pre>

CC BY-SA 4.0
2018-07-08T12:51:59.060Z
works! thank yoou!
Mvrcel Boer
CC BY-SA 4.0
2018-07-08T12:41:52.790Z
2018-07-08T12:41:52.790Z
carlcs
<ul>
<li>I have a Matrix with an entry field.</li>
<li>I have a Loop which is looping entries out of a section.</li>
</ul>

<p>Goal: The entries from the matrix should not appear in the loop of the section.  So the Matrix defines Starred Member Profiles and the loop trough the section is a teamlist, but the two starred profiles should not appear in there. </p>

<p>I tried something like this but i stuck right now... </p>

<pre><code>{# Get the profiles which are in the matrix #}
{% set highlightProfiles = entry.highlightProfiles.all() %}

{% for profile in highlightProfiles %}

 {# Just a test to see the ID of each single entry #}
 {{ profile.hightlightProfileTeaser.one().id() }} 

 {% set highlightProfileSingleIds = profile.hightlightProfileTeaser.all().ids() %}

{% endfor %}

{# set something up for the entry ids which should not join in the endloop #}
{% set highlightProfileIdsString = highlightProfileSingleIds | join(', not ') %}

{% set teamMembers = craft.entries({
 section: 'profiles',
 limit: 50 
}) %}

{% set allProfilesWithOutHighlights = teamMembers.id('and, not '~highlightProfileIdsString).orderBy('title asc') %}
{% for member in allOtherMembers.orderBy('title asc').all()  %}
 {{ member.title }} {{ member.id() }} {{ loop.index }}
{% endfor %}
</code></pre>

<matrix><entry><loop><join>
Entries from matrix should not appear in loop
# Entries from matrix should not appear in loop

(Asked by: username_0 on 2018-07-08)

I have a Matrix with an entry field.
I have a Loop which is looping entries out of a section.

Goal: The entries from the matrix should not appear in the loop of the section.  So the Matrix defines Starred Member Profiles and the loop trough the section is a teamlist, but the two starred profiles should not appear in there. 
I tried something like this but i stuck right now... 
{# Get the profiles which are in the matrix #}
{% set highlightProfiles = entry.highlightProfiles.all() %}

{% for profile in highlightProfiles %}

 {# Just a test to see the ID of each single entry #}
 {{ profile.hightlightProfileTeaser.one().id() }} 

 {% set highlightProfileSingleIds = profile.hightlightProfileTeaser.all().ids() %}

{% endfor %}

{# set something up for the entry ids which should not join in the endloop #}
{% set highlightProfileIdsString = highlightProfileSingleIds | join(', not ') %}

{% set teamMembers = craft.entries({
 section: 'profiles',
 limit: 50 
}) %}

{% set allProfilesWithOutHighlights = teamMembers.id('and, not '~highlightProfileIdsString).orderBy('title asc') %}
{% for member in allOtherMembers.orderBy('title asc').all()  %}
 {{ member.title }} {{ member.id() }} {{ loop.index }}
{% endfor %}

**Tags:** matrix, entry, loop, join


---

## 1 answers

### Answer by username_1 on 2018-07-08. Score: 3

You are on the right track, to “collect” the entry IDs you have to use the merge filter in your Matrix loop though.
{% set highlightProfileSingleIds = [] %}

{% for profile in highlightProfiles %}
    {% set ids = profile.hightlightProfileTeaser.ids() %}
    {% set highlightProfileSingleIds = highlightProfileSingleIds|merge(ids) %}
{% endfor %}

> **Comments:**
> **username_0**: works! thank yoou!  

---

