Answers.Body: <p>To achieve an empty state for my group (When there's no entries existing within that group). I re-assembled the array and outputted them in a certain order - allowing for an <code>if</code> to come alive when there actually wasn't any status available.</p>
  
  <pre><code>{% set proposals = craft.entries.section('proposals').authorId(currentUser.id) %}
  {% set proposalsByGroup = proposals|group('proposalStatus') %}
  
  {% for status in ['pending','accepted','delivered'] %}
  
    {% if proposalsByGroup[status] is defined %}
      {% set entriesInStatus = proposalsByGroup[status] %}
            {{ status }}
            {% for proposal in entriesInStatus %}
               Hello.
            {% endfor %}
    {% else %}
            {{ status }}
            Nothing here, but still gives a status that you've set above.
    {% endif %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-15T16:35:27.217Z
Answers.LastActivityDate: 2019-05-15T16:35:27.217Z
Answers.UserDisplayName: JMKelley
Body: <p>I have entries that are getting grouped, but I've noticed that it will return nothing if there's nothing within a group. I'm looking to see if there's a possibility of showing an empty state to a user? </p>
  
  <pre><code>{% set loopCount = 0 %}
  {% for status, proposals in proposalsByGroup %}
    {% if proposals|length %}
    {% set loopCount = loopCount + 1 %}
    &lt;div class="tab-pane fade" id="pills-{{ loopCount }}" role="tabpanel" aria-labelledby="pills-{{ status }}-tab"&gt;
      {{ status }}
        {% for proposal in proposals %}
            &lt;div class="row my-3"&gt;
              &lt;div class="col"&gt;
                &lt;div class="card"&gt;
                  {% include 'proposal/_proposalInfluencer.html' %}
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
        {% endfor %}
    &lt;/div&gt;
    {% else %}
      There's nothing here!
    {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>Unfortunately, the above does nothing as no group actually exists so it won't run the code?</p>
  
Tags: <templating>
Title: Entry Group Empty State
ThreadText: # Entry Group Empty State
  
  (Asked by: username_0 on 2019-05-15)
  
  I have entries that are getting grouped, but I've noticed that it will return nothing if there's nothing within a group. I'm looking to see if there's a possibility of showing an empty state to a user?
  
  ```
  {% set loopCount = 0 %}
  {% for status, proposals in proposalsByGroup %}
    {% if proposals|length %}
    {% set loopCount = loopCount + 1 %}
    <div class="tab-pane fade" id="pills-{{ loopCount }}" role="tabpanel" aria-labelledby="pills-{{ status }}-tab">
      {{ status }}
        {% for proposal in proposals %}
            <div class="row my-3">
              <div class="col">
                <div class="card">
                  {% include 'proposal/_proposalInfluencer.html' %}
                </div>
              </div>
            </div>
        {% endfor %}
    </div>
    {% else %}
      There's nothing here!
    {% endif %}
  {% endfor %}
  
  ```
  
  Unfortunately, the above does nothing as no group actually exists so it won't run the code?
  
  **Tags:** templating
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-05-15. Score: 1 | Accepted answer
  
  To achieve an empty state for my group (When there's no entries existing within that group). I re-assembled the array and outputted them in a certain order - allowing for an `if` to come alive when there actually wasn't any status available.
  
  ```
  {% set proposals = craft.entries.section('proposals').authorId(currentUser.id) %}
  {% set proposalsByGroup = proposals|group('proposalStatus') %}
  
  {% for status in ['pending','accepted','delivered'] %}
  
    {% if proposalsByGroup[status] is defined %}
      {% set entriesInStatus = proposalsByGroup[status] %}
            {{ status }}
            {% for proposal in entriesInStatus %}
               Hello.
            {% endfor %}
    {% else %}
            {{ status }}
            Nothing here, but still gives a status that you've set above.
    {% endif %}
  {% endfor %}
  
  ```
  
  
  ---
  
  