Answers.Body: <p>That plugin doesn't provide a custom element type, so there's no way for it to have a chance to modify the main elements query when fetching the data.</p>
  
  <p>In its existing form, you'll have to do the filtering on the Twig side like you're doing to grab the one you're looking for.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-16T08:58:15.383Z
Answers.Text: I feared that was the case. No worries.
Answers.UserDisplayName: Clive Portman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-15T22:06:41.280Z
Answers.LastActivityDate: 2017-03-15T22:06:41.280Z
Answers.UserDisplayName: Brad Bell
Body: <p>I'm using the <a href="https://github.com/bjerenec/craftcms-multidatefield" rel="nofollow noreferrer">multidate field</a> plugin, which is excellent at presenting dates but I need to return entries based on testing the first date in there. I typically test with the entries loop, like so:</p>
  
  <pre><code>{% if product.dates.dates[0] | date('U') &gt; now | date ('U') %}
  </code></pre>
  
  <p>but would prefer to only get entries fitting that criteria in the first place. Is there any way to fetch entries according to the first value in a an array like this?</p>
  
  <pre><code>{% set products = craft.commerce.products.dates(somehow only test the first value in the dates array here) %}
  </code></pre>
  
  <p>The field looks something like this:</p>
  
  <pre><code>dates [ // this is the custom field name
      dates [ // this is the dates array within the custom field
          [0] // this is the date object I want to test against
          [1]
          [2]
      ]
  ]
  </code></pre>
  
Tags: <entries>
Title: Fetch entries filtered by array within custom field
ThreadText: # Fetch entries filtered by array within custom field
  
  (Asked by: username_0 on 2017-03-15)
  
  I'm using the [multidate field](https://github.com/bjerenec/craftcms-multidatefield) plugin, which is excellent at presenting dates but I need to return entries based on testing the first date in there. I typically test with the entries loop, like so:
  
  ```
  {% if product.dates.dates[0] | date('U') > now | date ('U') %}
  
  ```
  
  but would prefer to only get entries fitting that criteria in the first place. Is there any way to fetch entries according to the first value in a an array like this?
  
  ```
  {% set products = craft.commerce.products.dates(somehow only test the first value in the dates array here) %}
  
  ```
  
  The field looks something like this:
  
  ```
  dates [ // this is the custom field name
      dates [ // this is the dates array within the custom field
          [0] // this is the date object I want to test against
          [1]
          [2]
      ]
  ]
  
  ```
  
  **Tags:** entries
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-03-15. Score: 1 | Accepted answer
  
  That plugin doesn't provide a custom element type, so there's no way for it to have a chance to modify the main elements query when fetching the data.
  
  In its existing form, you'll have to do the filtering on the Twig side like you're doing to grab the one you're looking for.
  
  > **Comments:**
  > **username_0**: I feared that was the case. No worries.  
  
  ---
  
  