Answers.Body: <p>You can definitely access and use fields on the entry you're viewing within a matrix field loop. The only thing you need to watch out for is repeating the <code>entry</code> variable in your <code>for</code> loop.</p>
  
  <p>You can simplify your <code>if</code> statement slightly by using <code>{% if not entry.applicationsClosed %}</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-01T08:40:33.000Z
Answers.Text: I ended up using {% set applicationsClosed = entry.applicationsClosed %} and then it was all good. By your answer it looks like I messed up the loop, so I will see if I can sort that out. Many thanks.
Answers.UserDisplayName: sarah3585
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-30T16:20:28.783Z
Answers.LastActivityDate: 2016-08-30T16:20:28.783Z
Answers.UserDisplayName: Luke Pearce
Body: <p>Is it possible to control if some content shows that's within a Matrix field if a lightswitch field on the entry is <code>false</code>.</p>
  
  <p>I expect not as you're inside the matrix loop.</p>
  
  <pre><code>{% for block in entry.section3 %}
   ...
  {% if block.applyButton %}
   ...
     {% if entry.applicationsClosed('not 1') %}
      {% for asset in entry.applyButtonDocument %}
       &lt;a href="{{ asset.getUrl() }}" class="button button--black"&gt;apply&lt;/a&gt;
      {% endfor %}
     {% endif %}
  ...
  {% endif %} 
  ....
  {% endfor %}        
  </code></pre>
  
  <p>I don't want to put the lightswitch within the Matrix as that would put it in an illogical place and would be needed to be switched multiple times. </p>
  
  <p>It's being used as more of a global setting across the page to change various bits of content.</p>
  
Tags: <matrix><lightswitch>
Title: Entries lightswitch field within matrix
ThreadText: # Entries lightswitch field within matrix
  
  (Asked by: username_0 on 2016-08-30)
  
  Is it possible to control if some content shows that's within a Matrix field if a lightswitch field on the entry is `false`.
  
  I expect not as you're inside the matrix loop.
  
  ```
  {% for block in entry.section3 %}
   ...
  {% if block.applyButton %}
   ...
     {% if entry.applicationsClosed('not 1') %}
      {% for asset in entry.applyButtonDocument %}
       <a href="{{ asset.getUrl() }}" class="button button--black">apply</a>
      {% endfor %}
     {% endif %}
  ...
  {% endif %} 
  ....
  {% endfor %}        
  
  ```
  
  I don't want to put the lightswitch within the Matrix as that would put it in an illogical place and would be needed to be switched multiple times.
  
  It's being used as more of a global setting across the page to change various bits of content.
  
  **Tags:** matrix, lightswitch
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-08-30. Score: 3
  
  You can definitely access and use fields on the entry you're viewing within a matrix field loop. The only thing you need to watch out for is repeating the `entry` variable in your `for` loop.
  
  You can simplify your `if` statement slightly by using `{% if not entry.applicationsClosed %}`
  
  > **Comments:**
  > **username_0**: I ended up using {% set applicationsClosed = entry.applicationsClosed %} and then it was all good. By your answer it looks like I messed up the loop, so I will see if I can sort that out. Many thanks.  
  
  ---
  
  