Answers.Body: <p>If I understand correctly, you want to show a list of entries that only match the entry type of "My Type" and group them together by date. A simplified list might look something like this:</p>
  
  <pre><code>Jan 1, 2017
    entry 1
    entry 5
    entry 8
  
  Jan 4, 2017
    entry 2
    entry 4
    entry 11
  
  Jan 11, 2017
    entry 6
  </code></pre>
  
  <p>First, you'll have to specify the entry type with it's handle (camel case) like "myType" not "My Type."</p>
  
  <p>Following the example from Craft's docs on the <a href="https://craftcms.com/docs/templating/filters#group" rel="nofollow noreferrer">group filter</a>, you would probably do something like this:</p>
  
  <pre class="lang-twig prettyprint-override"><code>{# Get attempts entries matching entry type 'myType' #}
  {% set attempts = craft.entries.section('attempts').type('myType').find() %}
  
  {# Group attempts by date #}
  {% for date, attemptsByDate in attempts|group('attemptDate.day') %}
  
    &lt;h2&gt;{{ date|date('M j, Y') }}&lt;/h2&gt;
  
    {# loop thru the attempts grouped by date  #}
    &lt;ul&gt;
      {% for entry in attemptsByDate %}
        &lt;li&gt;{{ entry.title }}&lt;/li&gt;
      {% endfor %}
    &lt;/ul&gt;
  {% endfor %}
  </code></pre>
  
  <p>If there were other entries that didn't match type 'myType' on another day, say Jan 3rd, you won't see Jan 3rd in the list at all.</p>
  
  <p>I'm not totally sure what you need to do with <code>{{ count }}</code> and <code>{{ total }}</code>, but hopefully this gets you on the right track.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-02T05:32:52.097Z
Answers.LastActivityDate: 2017-03-03T01:26:53.853Z
Answers.LastEditDate: 2017-03-03T01:26:53.853Z
Answers.UserDisplayName: Alex Roper
Answers.Body: <p>This should work:</p>
  
  <pre><code>{% for date, attempt in attempts|group('attemptDate') %}
      &lt;tr&gt;
        &lt;td&gt;{{ date|date('M j, Y') }}&lt;/td&gt;
        {% for entry in attempt %}
          {% if entry.type == 'My Type' %}
            &lt;td&gt;{{ entry.title }}&lt;/td&gt;
          {% endif %}
        {% endfor %}
      &lt;/tr&gt;
    {% endfor %}
  </code></pre>
  
  <p>I don't know what you want to do with the 'type' of the entries?
  But if you want to limit the amount of entries according to type, you could fill "attempts" with all entries of a certain type first and then loop through them. Than you could remove the if statement which would be cleaner and faster I think.</p>
  
  <p>So something like: </p>
  
  <pre><code>{% set attempts = craft.entries.section("something").type("My Type").find() %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-29T14:28:32.957Z
Answers.LastActivityDate: 2017-01-29T14:35:11.823Z
Answers.LastEditDate: 2017-01-29T14:35:11.823Z
Answers.UserDisplayName: Tom De Smet
Body: <p>I am grouping entries that have the same date together so that I only get a single date. Works great.</p>
  
  <p>I would like to loop through each entry that has that date and I'm not having much luck. I want to show </p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>{% for date, attempt in attempts|group('attemptDate') %}
      &lt;tr&gt;
          &lt;td&gt;{{ date|date('M j, Y') }}&lt;/td&gt;
          {% if type == 'My Type' %}
              {# Get all entries where type = My Type &amp; entry.attemptDate = date. #}
              {% set total = 0 %}
              {% count = 0 %}
              {% for ?? in ?? %} {# 
                  {% total = loop.index %}
                  {% count = {# if value in myField is true #} %}
                  &lt;td&gt;{{ count }}/{{ total }}&lt;/td&gt;
              {% endfor %}
          {% endif %}
      &lt;/tr&gt;
  {% endfor %}
  </code></pre>
  
  <p>Thank you for any suggestions!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-01-29T09:31:06.543Z
Comments.Text: {% for entry in attempt not working? %}
Comments.UserDisplayName: Jan_dh
Tags: <templating>
Title: How can I use a where statement with grouped results?
ThreadText: # How can I use a where statement with grouped results?
  
  (Asked by: username_0 on 2017-01-29)
  
  I am grouping entries that have the same date together so that I only get a single date. Works great.
  
  I would like to loop through each entry that has that date and I'm not having much luck. I want to show
  
  Here is what I have so far:
  
  ```
  {% for date, attempt in attempts|group('attemptDate') %}
      <tr>
          <td>{{ date|date('M j, Y') }}</td>
          {% if type == 'My Type' %}
              {# Get all entries where type = My Type & entry.attemptDate = date. #}
              {% set total = 0 %}
              {% count = 0 %}
              {% for ?? in ?? %} {# 
                  {% total = loop.index %}
                  {% count = {# if value in myField is true #} %}
                  <td>{{ count }}/{{ total }}</td>
              {% endfor %}
          {% endif %}
      </tr>
  {% endfor %}
  
  ```
  
  Thank you for any suggestions!
  
  **Tags:** templating
  
  > **Comments:**
  > **username_1**: {% for entry in attempt not working? %}  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2017-03-02. Score: 1
  
  If I understand correctly, you want to show a list of entries that only match the entry type of "My Type" and group them together by date. A simplified list might look something like this:
  
  ```
  Jan 1, 2017
    entry 1
    entry 5
    entry 8
  
  Jan 4, 2017
    entry 2
    entry 4
    entry 11
  
  Jan 11, 2017
    entry 6
  
  ```
  
  First, you'll have to specify the entry type with it's handle (camel case) like "myType" not "My Type."
  
  Following the example from Craft's docs on the [group filter](https://craftcms.com/docs/templating/filters#group), you would probably do something like this:
  
  ```twig
  {# Get attempts entries matching entry type 'myType' #}
  {% set attempts = craft.entries.section('attempts').type('myType').find() %}
  
  {# Group attempts by date #}
  {% for date, attemptsByDate in attempts|group('attemptDate.day') %}
  
    <h2>{{ date|date('M j, Y') }}</h2>
  
    {# loop thru the attempts grouped by date  #}
    <ul>
      {% for entry in attemptsByDate %}
        <li>{{ entry.title }}</li>
      {% endfor %}
    </ul>
  {% endfor %}
  
  ```
  
  If there were other entries that didn't match type 'myType' on another day, say Jan 3rd, you won't see Jan 3rd in the list at all.
  
  I'm not totally sure what you need to do with `{{ count }}` and `{{ total }}`, but hopefully this gets you on the right track.
  
  
  ---
  
  ### Answer by username_3 on 2017-01-29. Score: 1
  
  This should work:
  
  ```
  {% for date, attempt in attempts|group('attemptDate') %}
      <tr>
        <td>{{ date|date('M j, Y') }}</td>
        {% for entry in attempt %}
          {% if entry.type == 'My Type' %}
            <td>{{ entry.title }}</td>
          {% endif %}
        {% endfor %}
      </tr>
    {% endfor %}
  
  ```
  
  I don't know what you want to do with the 'type' of the entries?
  But if you want to limit the amount of entries according to type, you could fill "attempts" with all entries of a certain type first and then loop through them. Than you could remove the if statement which would be cleaner and faster I think.
  
  So something like:
  
  ```
  {% set attempts = craft.entries.section("something").type("My Type").find() %}
  
  ```
  
  
  ---
  
  