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') %}
  • I asked a very similar question already Query for blocks across Block Types using the new field parameter? – hope this helps!
    – carlcs
    Mar 20 '15 at 19:05
  • 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() ) %} Mar 22 '15 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.