Answers.Body: <p>You should be able to do something like this:</p>
  <pre><code>{% for block in entry.eventSchedule
  .eventDate(eventDaySlug)
  .collect() 
  %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-29T17:13:50.483Z
Answers.Text: Excellent. Thank you.
Answers.UserDisplayName: CreateSean
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-29T17:12:00.900Z
Answers.LastActivityDate: 2023-05-29T17:12:00.900Z
Answers.UserDisplayName: Mike Mella
Body: <p>I've got an event entry with each day of the event in a matrix field block. The block has a date field eventDate and I've got it set up so each block has a unique page that display with the date in segment_3 of the url in this format 2023-07-01</p>
  <p>On that page I want to display the matrix again, but only that days block. I cannot figure out how to call a block where the dateEvent field matches the url segment.</p>
  <p>Below works with a conditional but it's also pulling in all matrix blocks, not the single block that we need.</p>
  <p>ideally there'd be a way to query a field in the block like this where <code>2023-07-01</code> is the date field value I want to filter by (coming from url segment 3).</p>
  <pre><code>{% for block in entry.eventSchedule.eventDate('2023-07-01')collect() %}
    more code here
  {% endfor %}
  </code></pre>
  <p>Current full code</p>
  <pre><code>{% set entrySlug = craft.app.request.getSegment('2') %}
  {% set eventDaySlug = craft.app.request.getSegment('3') %}
  {% set entry = craft.entries.slug(entrySlug).one() %}
  
  {% for block in entry.eventSchedule.collect() %}
    {#
      using a conditional to match the date works
      however still loading in all the other matrix blocks
      ideally we'd be able to filter in the for loop by checking the field value there.
    #}
    {% if block.eventDate|date('Y-m-d') == eventDaySlug %}
      &lt;h3 class=&quot;font-semibold text-green-700&quot;&gt;{{ block.eventTitle }}&lt;/h3&gt;
      &lt;p class=&quot;mb-8&quot;&gt;{{ block.eventDate|date('Y-m-d') }}&lt;/p&gt;
    {% endif %}
  {% endfor %}
  </code></pre>
  
Tags: <templating><matrix>
Title: Matrix Field - Call block that matches block field value
ThreadText: # Matrix Field - Call block that matches block field value
  
  (Asked by: username_0 on 2023-05-29)
  
  I've got an event entry with each day of the event in a matrix field block. The block has a date field eventDate and I've got it set up so each block has a unique page that display with the date in segment\_3 of the url in this format 2023-07-01
  
  On that page I want to display the matrix again, but only that days block. I cannot figure out how to call a block where the dateEvent field matches the url segment.
  
  Below works with a conditional but it's also pulling in all matrix blocks, not the single block that we need.
  
  ideally there'd be a way to query a field in the block like this where `2023-07-01` is the date field value I want to filter by (coming from url segment 3).
  
  ```
  {% for block in entry.eventSchedule.eventDate('2023-07-01')collect() %}
    more code here
  {% endfor %}
  
  ```
  
  Current full code
  
  ```
  {% set entrySlug = craft.app.request.getSegment('2') %}
  {% set eventDaySlug = craft.app.request.getSegment('3') %}
  {% set entry = craft.entries.slug(entrySlug).one() %}
  
  {% for block in entry.eventSchedule.collect() %}
    {#
      using a conditional to match the date works
      however still loading in all the other matrix blocks
      ideally we'd be able to filter in the for loop by checking the field value there.
    #}
    {% if block.eventDate|date('Y-m-d') == eventDaySlug %}
      <h3 class="font-semibold text-green-700">{{ block.eventTitle }}</h3>
      <p class="mb-8">{{ block.eventDate|date('Y-m-d') }}</p>
    {% endif %}
  {% endfor %}
  
  ```
  
  **Tags:** templating, matrix
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-05-29. Score: 2 | Accepted answer
  
  You should be able to do something like this:
  
  ```
  {% for block in entry.eventSchedule
  .eventDate(eventDaySlug)
  .collect() 
  %}
  
  ```
  
  > **Comments:**
  > **username_0**: Excellent. Thank you.  
  
  ---
  
  