Answers.Body: <p>Not an expert myself, but you can try <code>.contains('OR', 'a', 'b', 'c', 'e')</code></p>
  
  <p>However, rather than first fetch all entries and then filter them, I would look into using relations when looking them up, so that the initial result only contains the entries you're after.</p>
  
  <p>Have a look at <a href="https://craftcms.com/docs/relations" rel="nofollow noreferrer">https://craftcms.com/docs/relations</a> to get started, and don't be afraid to ask for help if you can't quite figure them out (I found them a little tricky myself when first attempting to use them).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-02T08:31:38.583Z
Answers.LastActivityDate: 2016-11-02T08:31:38.583Z
Answers.UserDisplayName: Fuglsetrampen
Body: <p><strong>preface</strong>: i'm new to craft so may get terminology incorrect</p>
  
  <p><strong>basic idea</strong>: i would like to show entries of a particular channel which have multi-select field values which intersect with another set of values. e.g. given set ['a','c','e'] it would show entries with values such as ['a','b',c'] and ['e'] but not ['b','d'].</p>
  
  <p><strong>what i have done so far</strong>:</p>
  
  <p>my basic ElementCriteriaModel for entries in the past is defined:</p>
  
  <pre><code>{% set results = craft.entries({
      section: ['mysection'],
      when: ' &lt;= ' ~ now,
      order: 'when desc',
  }) %}
  
  {% for entry in results %}
  .... blah blah do stuff
  </code></pre>
  
  <p>and what i would like to do is add another criteria on there for the multi-select field. however, from what i am reading and have tried it doesn't seem like that kind of filtering is available. please stop now and prove me wrong if this is not the case!</p>
  
  <p>i was able to filter matching a single option of the multi-select by using:</p>
  
  <pre><code>{% for entry in results if entry.myMultiSelect.contains('a') %}
  </code></pre>
  
  <p>but was unable to determine syntax to "OR" the results with another contains(). really not much documentation that i could find on that method.</p>
  
  <p>alternately i possibly could use a search, but sounds like that relies on indexes that may get out of date which i would like to avoid. wouldn't be a huge deal, but looking for the "right" answer before i settle on brute forcing it by just looping through the multi-select values inside the loop to check for a match.</p>
  
Tags: <elementcriteriamodel><filter>
Title: multi-select OR values to filter entries
ThreadText: # multi-select OR values to filter entries
  
  (Asked by: username_0 on 2016-10-20)
  
  **preface**: i'm new to craft so may get terminology incorrect
  
  **basic idea**: i would like to show entries of a particular channel which have multi-select field values which intersect with another set of values. e.g. given set ['a','c','e'] it would show entries with values such as ['a','b',c'] and ['e'] but not ['b','d'].
  
  **what i have done so far**:
  
  my basic ElementCriteriaModel for entries in the past is defined:
  
  ```
  {% set results = craft.entries({
      section: ['mysection'],
      when: ' <= ' ~ now,
      order: 'when desc',
  }) %}
  
  {% for entry in results %}
  .... blah blah do stuff
  
  ```
  
  and what i would like to do is add another criteria on there for the multi-select field. however, from what i am reading and have tried it doesn't seem like that kind of filtering is available. please stop now and prove me wrong if this is not the case!
  
  i was able to filter matching a single option of the multi-select by using:
  
  ```
  {% for entry in results if entry.myMultiSelect.contains('a') %}
  
  ```
  
  but was unable to determine syntax to "OR" the results with another contains(). really not much documentation that i could find on that method.
  
  alternately i possibly could use a search, but sounds like that relies on indexes that may get out of date which i would like to avoid. wouldn't be a huge deal, but looking for the "right" answer before i settle on brute forcing it by just looping through the multi-select values inside the loop to check for a match.
  
  **Tags:** elementcriteriamodel, filter
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-11-02. Score: 1
  
  Not an expert myself, but you can try `.contains('OR', 'a', 'b', 'c', 'e')`
  
  However, rather than first fetch all entries and then filter them, I would look into using relations when looking them up, so that the initial result only contains the entries you're after.
  
  Have a look at <https://craftcms.com/docs/relations> to get started, and don't be afraid to ask for help if you can't quite figure them out (I found them a little tricky myself when first attempting to use them).
  
  
  ---
  
  