Answers.Body: <pre><code>{% if '4' not in navigation.navi.ids() %}
      {% exit 404 %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T11:50:52.617Z
Answers.LastActivityDate: 2015-06-19T11:50:52.617Z
Answers.UserDisplayName: Bob Olde Hampsink
Body: <p>Is it possible to check a matrix array for an ID?</p>
  
  <p>I created a entries field which functions as a navigation.
  Now if the user decides to remove one entry I want the specific template to return a 404</p>
  
  <p><img src="https://i.sstatic.net/aOUb2.png" alt="enter image description here"></p>
  
  <p>I thought something like (Assuming we are in the "Journalismus" template):</p>
  
  <pre><code>{% for navi in navigation.navi %}
      {% if '4' not in navi.id %}
          {% exit 404 %}
      {% endif %}
  {% endfor  %}
  </code></pre>
  
  <p>But that does pass the 404 always.</p>
  
  <p>Or is there a better way to do this?</p>
  
Tags: <matrix><conditional><entries-field><id>
Title: If loop contains id `X`
ThreadText: # If loop contains id `X`
  
  (Asked by: username_0 on 2015-06-19)
  
  Is it possible to check a matrix array for an ID?
  
  I created a entries field which functions as a navigation.
  Now if the user decides to remove one entry I want the specific template to return a 404
  
  ![enter image description here](https://i.sstatic.net/aOUb2.png)
  
  I thought something like (Assuming we are in the "Journalismus" template):
  
  ```
  {% for navi in navigation.navi %}
      {% if '4' not in navi.id %}
          {% exit 404 %}
      {% endif %}
  {% endfor  %}
  
  ```
  
  But that does pass the 404 always.
  
  Or is there a better way to do this?
  
  **Tags:** matrix, conditional, entries-field, id
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-06-19. Score: 3 | Accepted answer
  
  ```
  {% if '4' not in navigation.navi.ids() %}
      {% exit 404 %}
  {% endif %}
  
  ```
  
  
  ---
  
  