<p>I am trying to filter an entry's matrix blocks to just the ones with either operational <strong>OR</strong> hazardous checked (lightswitch). I can chain it together with one, how do you grab items with <em>either</em> checked? See the end of the following line.</p>

<pre><code>{% set filteredComponents = entry.propertyComponents.relatedTo(category).status('live').order('componentName asc').operational('= 1') %}
</code></pre>

CC BY-SA 3.0
2015-03-20T19:05:14.770Z
I asked a very similar question already [Query for blocks across Block Types using the new field parameter?](http://craftcms.stackexchange.com/q/5056/125) – hope this helps!
carlcs
CC BY-SA 3.0
2015-03-22T12:08:56.033Z
Thank you, that did lead me to a solution. To merge I had to add find() so they were arrays.
    {% set filteredComps = asset.assetComponents.relatedTo(category).status('live').order('componentName asc').operational('= 1').find() 
    | merge( asset.assetComponents.relatedTo(category).status('live').order('componentName asc').hazardous('= 1').find() ) %}
Shift2Design
<matrix><filter>
Filtering Matrix blocks
# Filtering Matrix blocks

(Asked by: username_0 on 2015-03-20)

I am trying to filter an entry's matrix blocks to just the ones with either operational OR hazardous checked (lightswitch). I can chain it together with one, how do you grab items with either checked? See the end of the following line.
{% set filteredComponents = entry.propertyComponents.relatedTo(category).status('live').order('componentName asc').operational('= 1') %}

**Tags:** matrix, filter

> **Comments:**
> **username_1**: I asked a very similar question already [Query for blocks across Block Types using the new field parameter?](http://craftcms.stackexchange.com/q/5056/125) – hope this helps!  
> **username_0**: Thank you, that did lead me to a solution. To merge I had to add find() so they were arrays.     {% set filteredComps = asset.assetComponents.relatedTo(category).status('live').order('componentName asc').operational('= 1').find()      | merge( asset.assetComponents.relatedTo(category).status('live').order('componentName asc').hazardous('= 1').find() ) %}  

---

## 0 answers

