<p>It should be a string:</p>

<pre><code>{% for entry in craft.entries({ section: 'news', limit: 2, id: 'not 42' }) %}
</code></pre>

<p>so concat your variable like so:</p>

<pre><code>{% for entry in craft.entries({ section: 'news', limit: 2, id: 'not ' ~ this_id }) %}
</code></pre>

CC BY-SA 3.0
2015-04-08T20:02:27.803Z
2015-04-08T20:02:27.803Z
carlcs
<p>i think the following code shows the problem:</p>

<pre><code>{% for entry in craft.entries({ section: 'news', limit: 2, **id: not this_id** }) %}
</code></pre>

<p>the big one doesn't work in this way. Has anyone an idea?</p>

<p>The content of this_id is a number.</p>

<p>Thank you! </p>

<entry><variable>
id: 'not' with variable
# id: 'not' with variable

(Asked by: username_0 on 2015-04-08)

i think the following code shows the problem:
{% for entry in craft.entries({ section: 'news', limit: 2, **id: not this_id** }) %}

the big one doesn't work in this way. Has anyone an idea?
The content of this_id is a number.
Thank you!

**Tags:** entry, variable


---

## 1 answers

### Answer by username_1 on 2015-04-08. Score: 12 | Accepted answer

It should be a string:
{% for entry in craft.entries({ section: 'news', limit: 2, id: 'not 42' }) %}

so concat your variable like so:
{% for entry in craft.entries({ section: 'news', limit: 2, id: 'not ' ~ this_id }) %}


---

