Answers.Body: <p>Try to group the entries sorted by size using the <code>group</code> filter:</p>
  
  <pre><code>{% set entriesSorted = entries|supersort('sortAs', '{ size }', SORT_NUMERIC) %}
  {% set entriesByBrand = entriesSorted|group('brand.first.title') %}
  {% set entriesByBrand = entriesByBrand|supersort('ksort') %}
  
  {% for brand, entriesInBrand in entriesByBrand %}
      {% for entry in entriesInBrand %}
          &lt;li&gt;{{ entry.title }}&lt;/li&gt;
      {% endfor %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-02T14:16:40.160Z
Answers.Text: Thanks that grouped my entries by brand and ordered them by size. Is there a way to have the grouped brands display alphabetically?
Answers.UserDisplayName: triplethreat23
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-02T16:55:32.397Z
Answers.Text: Try to add another Supersort filter using 'ksort' method @triplethreat23!
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-02T05:17:23.773Z
Answers.LastActivityDate: 2015-12-02T16:54:59.553Z
Answers.LastEditDate: 2015-12-02T16:54:59.553Z
Answers.UserDisplayName: carlcs
Body: <p>I have entries that I would like to sort by 2 fields. First I would like to sort (or group) all of the entries in alphabetical order by a category field (brand), and then within each grouped brand I would like to sort the entries by a number field ascending (size).</p>
  
  <p>I can perform both sorts individually with the syntax below, but I’m having difficulty combining them for a multisort-like function.</p>
  
  <pre><code> entries|supersort('sortAs', '{ brand.first.title }')
   entries|supersort('sortAs', '{ size }', SORT_NUMERIC)
  </code></pre>
  
Tags: <sorting><plugin-supersort><sort>
Title: Multisort with supersort plugin
ThreadText: # Multisort with supersort plugin
  
  (Asked by: username_0 on 2015-12-02)
  
  I have entries that I would like to sort by 2 fields. First I would like to sort (or group) all of the entries in alphabetical order by a category field (brand), and then within each grouped brand I would like to sort the entries by a number field ascending (size).
  
  I can perform both sorts individually with the syntax below, but I’m having difficulty combining them for a multisort-like function.
  
  ```
   entries|supersort('sortAs', '{ brand.first.title }')
   entries|supersort('sortAs', '{ size }', SORT_NUMERIC)
  
  ```
  
  **Tags:** sorting, plugin-supersort, sort
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-12-02. Score: 2 | Accepted answer
  
  Try to group the entries sorted by size using the `group` filter:
  
  ```
  {% set entriesSorted = entries|supersort('sortAs', '{ size }', SORT_NUMERIC) %}
  {% set entriesByBrand = entriesSorted|group('brand.first.title') %}
  {% set entriesByBrand = entriesByBrand|supersort('ksort') %}
  
  {% for brand, entriesInBrand in entriesByBrand %}
      {% for entry in entriesInBrand %}
          <li>{{ entry.title }}</li>
      {% endfor %}
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks that grouped my entries by brand and ordered them by size. Is there a way to have the grouped brands display alphabetically?  
  > **username_1**: Try to add another Supersort filter using 'ksort' method @username_0!  
  
  ---
  
  