<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>

CC BY-SA 3.0
2018-01-11T14:56:02.003Z
2018-01-11T14:56:02.003Z
Robin Schambach
<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>

<categories><forloop><group><drop-down><craft.entries>
error when trying to loop through grouped entries according to dropdown field
# 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 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 %}
    {{cat}}
    {% for entry in entriesInCat %}
        
            {{entry.title}}
            {{entry.resourceContent}}
        
    {% 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


---

