Answers.Body: <p>I got this to work with the following:</p>
  
  <pre><code>{% set allCharges = craft.charge.charges.limit(5) %}
  {% set charges = allCharges|group("dateCreated|date('F')") %}
  
  {% for month, details in charges %}
      &lt;div&gt;   
          {{ month }}
  
          {% for detail in details %}
              &lt;p&gt;{{detail.id}}{{detail.customerName}}&lt;/p&gt;
          {% endfor %}
      &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>Two things to note: the group filter was applied to the results of the Charges query, rather than applying it to the query itself; the second issue is that the Charge model contains sub-models,which will require an inner loop. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-06T19:08:33.917Z
Answers.LastActivityDate: 2018-01-08T00:16:10.493Z
Answers.LastEditDate: 2018-01-08T00:16:10.493Z
Answers.UserDisplayName: Roi Agneta
Body: <p>Has anyone had success using the Group filter with Squarebit Charge? </p>
  
  <p>I tried a few different approaches, in each case getting array errors. Here is code:</p>
  
  <pre><code>{% set allCharges = craft.charge.charges.limit(3)|group('cardName') %}
  </code></pre>
  
  <p>{% for cardName, details in allCharges %}</p>
  
  <pre><code>{{ cardName }}
  
  {% for details in allCharges %} 
      {{ details.dateCreated }}...and more fields
  {% endfor %}
  </code></pre>
  
  <p>{% endfor %}</p>
  
  <p>This throws an error message <em>"Key "dateCreated" for array with keys "0" does not exist."</em> </p>
  
  <p>If I dump(details) I see an array that looks like all the fields you would expect, including "dateCreated"</p>
  
  <p>Any help would be appreciated!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-06T00:14:32.253Z
Comments.Text: Is there a certain reason why you loop twice?
Comments.UserDisplayName: Robin Schambach
Tags: <plugin-charge><group>
Title: Using the Group filter with Squarebit Charge plugin
ThreadText: # Using the Group filter with Squarebit Charge plugin
  
  (Asked by: username_0 on 2018-01-05)
  
  Has anyone had success using the Group filter with Squarebit Charge?
  
  I tried a few different approaches, in each case getting array errors. Here is code:
  
  ```
  {% set allCharges = craft.charge.charges.limit(3)|group('cardName') %}
  
  ```
  
  {% for cardName, details in allCharges %}
  
  ```
  {{ cardName }}
  
  {% for details in allCharges %} 
      {{ details.dateCreated }}...and more fields
  {% endfor %}
  
  ```
  
  {% endfor %}
  
  This throws an error message *"Key "dateCreated" for array with keys "0" does not exist."*
  
  If I dump(details) I see an array that looks like all the fields you would expect, including "dateCreated"
  
  Any help would be appreciated!
  
  **Tags:** plugin-charge, group
  
  > **Comments:**
  > **username_1**: Is there a certain reason why you loop twice?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-01-06. Score: 1
  
  I got this to work with the following:
  
  ```
  {% set allCharges = craft.charge.charges.limit(5) %}
  {% set charges = allCharges|group("dateCreated|date('F')") %}
  
  {% for month, details in charges %}
      <div>   
          {{ month }}
  
          {% for detail in details %}
              <p>{{detail.id}}{{detail.customerName}}</p>
          {% endfor %}
      </div>
  {% endfor %}
  
  ```
  
  Two things to note: the group filter was applied to the results of the Charges query, rather than applying it to the query itself; the second issue is that the Charge model contains sub-models,which will require an inner loop.
  
  
  ---
  
  