<p>You can get the entry IDs that have are related to the category and then exclude them from the all the entries.</p>

<pre><code>{% set entryIdsWithCategory = 
craft.entries.section('driverPositions').relatedTo('7192').limit(null).ids() %}

{% set entryIdsWithoutCategory = craft.entries.section('driverPositions').limit(null).ids()|without(entryIdsWithCategory) %}

{% set entries = craft.entries.section('businesses').limit(null).id(entryIdsWithoutCategory).order('state, city') %}

{% for entry in entries %}
    &lt;option value="{{entry.url}}"&gt;{{ entry.state }} - {{ entry.city }}&lt;/option&gt;
{% endfor %}
</code></pre>

CC BY-SA 4.0
2018-11-15T02:18:13.803Z
2018-11-16T04:11:54.840Z
2018-11-16T04:11:54.840Z
Simon Kuran
<p>Currently, this is NEARLY doing what I want except instead of the output being entries that do NOT have the id, it's output is ONLY the entries with the id.  I'm not sure why, since I've included the 'not' keyword within the parameter.</p>

<pre><code>{% set entries = 
craft.entries.section('driverPositions').limit(null).relatedTo('not' , 7192) %}

{% for entry in entries.order('state, city').limit(null) %}

&lt;option value="{{entry.url}}"&gt;{{ entry.state }} - {{ entry.city }}&lt;/option&gt;

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

<p>thanks in advance!</p>

<categories><entry><category><output><id>
Output values from all entries in a specific section EXCEPT those with a specific category id
# Output values from all entries in a specific section EXCEPT those with a specific category id

(Asked by: username_0 on 2018-11-14)

Currently, this is NEARLY doing what I want except instead of the output being entries that do NOT have the id, it's output is ONLY the entries with the id.  I'm not sure why, since I've included the 'not' keyword within the parameter.
{% set entries = 
craft.entries.section('driverPositions').limit(null).relatedTo('not' , 7192) %}

{% for entry in entries.order('state, city').limit(null) %}

{{ entry.state }} - {{ entry.city }}

{% endfor %}

thanks in advance!

**Tags:** categories, entry, category, output, id


---

## 1 answers

### Answer by username_1 on 2018-11-15. Score: 3

You can get the entry IDs that have are related to the category and then exclude them from the all the entries.
{% set entryIdsWithCategory = 
craft.entries.section('driverPositions').relatedTo('7192').limit(null).ids() %}

{% set entryIdsWithoutCategory = craft.entries.section('driverPositions').limit(null).ids()|without(entryIdsWithCategory) %}

{% set entries = craft.entries.section('businesses').limit(null).id(entryIdsWithoutCategory).order('state, city') %}

{% for entry in entries %}
    {{ entry.state }} - {{ entry.city }}
{% endfor %}


---

