<p>The question is a little unclear, is this what you are looking for?</p>

<pre><code>{% set requiredProgram = false %}
{% for block in entry.workshopInstructor %}
   {% if block.requiredPrograms.contains('Photoshop')%}
      {% set requiredProgram = true %}
   {% endif %}
{% endfor %}

{% if requiredProgram %}
  Photoshop is enabled on one of this entry's blocks field.
{% endif %}
</code></pre>

CC BY-SA 3.0
2015-06-12T00:19:27.127Z
The requiredProgram tag refers to a checkbox field that contains multiple entries. If any of the instructors inputted into the matrix field have a software, I'd like it to display on the main page, but separately on their own inner pages.
So this code works for the inner page

`{% for block in entry.workshopInstructor[0] %}
     {% if block.requiredPrograms.contains('Photoshop') %}
          foo
     {% endif %}
{% endfor %}`


But won't work for the outer page
So I need to somehow check if any of the entries have the checkbox ticked and if they do display the software.
JeffTalbot
CC BY-SA 3.0
2015-06-18T04:15:09.803Z
At first I didn't understand the solution but with a slight bit of codification it works great. Thanks
JeffTalbot
CC BY-SA 3.0
2015-06-11T10:40:32.327Z
2015-06-11T10:47:02.833Z
2015-06-11T10:47:02.833Z
Luke Holder
<p>I have a check box field called <code>requiredPrograms</code>, in it it has a selection of programs you can choose from. This is within a matrix field called <code>Work shop Instructor</code> which is for my workshop channel.</p>

<p>On my outside workshop page I'd like to display what programs are required for all the teachers at the workshop in the one spot. On the inner page they would be broken into separate programs per instructor.</p>

<p>I've done the inner page with no issue but I cannot figure out a way to do the outer one.</p>

<pre><code>{% for block in entry.workshopInstructor[0] and entry.workshopInstructor[1] %}
   {% if block.requiredPrograms.contains('Photoshop')%}
      &lt;p&gt;Foo&lt;/p&gt;
   {% endif %}
{% endfor %}
</code></pre>

<p>That is my current attempt but this results in nothing being displayed and other attempts have only produced the output twice.</p>

<p>Any suggestions?</p>

CC BY-SA 3.0
2015-06-11T07:29:22.860Z
What does ```entry.workshopInstructor[0]``` and ```entry.workshopInstructor[1]``` refer to?
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2015-06-12T00:15:47.970Z
@mmikkel It refers to the matrix field that I am trying to access. I'd like to check block[0] and block[1] to see if the checkbox Photoshop has been selected. If it is selected on either one I'd like it to display.
JeffTalbot
<matrix><blocks>
Is it possible to combine information from two blocks from a matrix to an if function?
# Is it possible to combine information from two blocks from a matrix to an if function?

(Asked by: username_0 on 2015-06-11)

I have a check box field called requiredPrograms, in it it has a selection of programs you can choose from. This is within a matrix field called Work shop Instructor which is for my workshop channel.
On my outside workshop page I'd like to display what programs are required for all the teachers at the workshop in the one spot. On the inner page they would be broken into separate programs per instructor.
I've done the inner page with no issue but I cannot figure out a way to do the outer one.
{% for block in entry.workshopInstructor[0] and entry.workshopInstructor[1] %}
   {% if block.requiredPrograms.contains('Photoshop')%}
      Foo
   {% endif %}
{% endfor %}

That is my current attempt but this results in nothing being displayed and other attempts have only produced the output twice.
Any suggestions?

**Tags:** matrix, blocks

> **Comments:**
> **username_1**: What does ```entry.workshopInstructor[0]``` and ```entry.workshopInstructor[1]``` refer to?  
> **username_0**: @mmikkel It refers to the matrix field that I am trying to access. I'd like to check block[0] and block[1] to see if the checkbox Photoshop has been selected. If it is selected on either one I'd like it to display.  

---

## 1 answers

### Answer by username_2 on 2015-06-11. Score: 2 | Accepted answer

The question is a little unclear, is this what you are looking for?
{% set requiredProgram = false %}
{% for block in entry.workshopInstructor %}
   {% if block.requiredPrograms.contains('Photoshop')%}
      {% set requiredProgram = true %}
   {% endif %}
{% endfor %}

{% if requiredProgram %}
  Photoshop is enabled on one of this entry's blocks field.
{% endif %}

> **Comments:**
> **username_0**: The requiredProgram tag refers to a checkbox field that contains multiple entries. If any of the instructors inputted into the matrix field have a software, I'd like it to display on the main page, but separately on their own inner pages. So this code works for the inner page  `{% for block in entry.workshopInstructor[0] %}      {% if block.requiredPrograms.contains('Photoshop') %}           foo      {% endif %} {% endfor %}`   But won't work for the outer page So I need to somehow check if any of the entries have the checkbox ticked and if they do display the software.  
> **username_0**: At first I didn't understand the solution but with a slight bit of codification it works great. Thanks  

---

