Answers.Body: <p>You have to remove the <code>entry</code> from your <code>entry.resourceType</code></p>
  
  <pre><code>{% set allEntriesByCat = allEntries|group('resourceType') %}
  </code></pre>
  
  <p>will work</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-11T14:56:02.003Z
Answers.LastActivityDate: 2018-01-11T14:56:02.003Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I was trying to follow <a href="https://craftcms.com/docs/templating/filters#group" rel="nofollow noreferrer">this example</a> from stack overflow to loop through a list of entries and output them by a custom dropdown field</p>
  
  
  
  <pre><code>{% set allEntries = craft.entries.section('resource').find() %}
  {% set allEntriesByCat = allEntries|group('entry.resourceType') %}
  {% for cat, entriesInCat in allEntriesByCat %}
      &lt;h2&gt;{{cat}}&lt;/h2&gt;
      {% for entry in entriesInCat %}
          &lt;article class="resource"&gt;
              &lt;h3 class="resource__name"&gt;&lt;a class="resource__link" href="{{entry.resourceLink}}"&gt;{{entry.title}}&lt;/a&gt;&lt;/h3&gt;
              &lt;div class="resource__content"&gt;{{entry.resourceContent}}&lt;/div&gt;
          &lt;/article&gt;
      {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>But if I do that, I get the error: <code>Internal Server Error
  Craft\EntryModel and its behaviors do not have a method or closure named "entry".</code></p>
  
Tags: <categories><forloop><group><drop-down><craft.entries>
Title: error when trying to loop through grouped entries according to dropdown field
ThreadText: # error when trying to loop through grouped entries according to dropdown field
  
  (Asked by: username_0 on 2018-01-11)
  
  I was trying to follow [this example](https://craftcms.com/docs/templating/filters#group) from stack overflow to loop through a list of entries and output them by a custom dropdown field
  
  ```
  {% set allEntries = craft.entries.section('resource').find() %}
  {% set allEntriesByCat = allEntries|group('entry.resourceType') %}
  {% for cat, entriesInCat in allEntriesByCat %}
      <h2>{{cat}}</h2>
      {% for entry in entriesInCat %}
          <article class="resource">
              <h3 class="resource__name"><a class="resource__link" href="{{entry.resourceLink}}">{{entry.title}}</a></h3>
              <div class="resource__content">{{entry.resourceContent}}</div>
          </article>
      {% endfor %}
  {% endfor %}
  
  ```
  
  But if I do that, I get the error: `Internal Server Error
  Craft\EntryModel and its behaviors do not have a method or closure named "entry".`
  
  **Tags:** categories, forloop, group, drop-down, craft.entries
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-01-11. Score: 1 | Accepted answer
  
  You have to remove the `entry` from your `entry.resourceType`
  
  ```
  {% set allEntriesByCat = allEntries|group('resourceType') %}
  
  ```
  
  will work
  
  
  ---
  
  