<p>You need to exclude the ids from the beginning.</p>

<pre><code>{% set excludeIds = currentUser.completed.ids() %}
{% set entry = craft
    .entries
    .section([
        'getStarted',
        'rollOut',
        'assessAndPrioritize',
        'agreeCommit',
        'measureSuccess'
    ])
    .order({stepNumber: SORT_ASC})
    .where(['not in', 'elements.id', excludeIds])
    .one()
%}
</code></pre>

<p><code>.where(['not in', 'elements.id', excludeIds])</code> will remove all ids in your field from your query.</p>

CC BY-SA 4.0
2018-07-31T06:40:59.490Z
2018-07-31T06:40:59.490Z
Robin Schambach
<p>I'm trying to show the next post that's not in the array of articles "completed". I have the next articles showing that haven't been completed, however i can't set a limit to just show one article. Any ideas?</p>

<p>here's my code </p>

<pre><code>{% for entry in craft.entries.section(['getStarted', 'rollOut', 'assessAndPrioritize', 'agreeCommit','measureSuccess']).order('stepNumber asc')  %}

    {% set test = currentUser and entry.id not in currentUser.completed.ids()  %}

    {% if test == true %}
        {{entry.title}}&lt;br&gt;
    {% endif %}

{% endfor %}
</code></pre>

CC BY-SA 4.0
2018-07-31T02:11:32.560Z
Forgot to mention the limit works on the first article, but when it's "completed" and is in the entries field on the user side, it just shows blank.
Kevin Love
<entries><craft3>
Limit not working
# Limit not working

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

I'm trying to show the next post that's not in the array of articles "completed". I have the next articles showing that haven't been completed, however i can't set a limit to just show one article. Any ideas?
here's my code 
{% for entry in craft.entries.section(['getStarted', 'rollOut', 'assessAndPrioritize', 'agreeCommit','measureSuccess']).order('stepNumber asc')  %}

    {% set test = currentUser and entry.id not in currentUser.completed.ids()  %}

    {% if test == true %}
        {{entry.title}}
    {% endif %}

{% endfor %}

**Tags:** entries, craft3
> **Comments:**
> **username_0**: Forgot to mention the limit works on the first article, but when it's "completed" and is in the entries field on the user side, it just shows blank.  

---

## 1 answers

### Answer by username_1 on 2018-07-31. Score: 2

You need to exclude the ids from the beginning.
{% set excludeIds = currentUser.completed.ids() %}
{% set entry = craft
    .entries
    .section([
        'getStarted',
        'rollOut',
        'assessAndPrioritize',
        'agreeCommit',
        'measureSuccess'
    ])
    .order({stepNumber: SORT_ASC})
    .where(['not in', 'elements.id', excludeIds])
    .one()
%}

.where(['not in', 'elements.id', excludeIds]) will remove all ids in your field from your query.


---

