Answers.Body: <p>The suggestion to order by sectionId resolved my issue here. </p>
  
  <p>{% set entries = craft.entries().section('extendedEvents, festivalEvents'). orderBy({sectionId: SORT_ASC}) %}</p>
  
  <p>As it was, I was working with two sections, so my quick fix was to simply reverse the order of the output of the for loop...</p>
  
  <p>{% for section, eventsInSection in allEventsBySection | reverse %}                          </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-28T12:27:35.033Z
Answers.LastActivityDate: 2019-03-28T12:27:35.033Z
Answers.UserDisplayName: Kevin
Body: <p>Im grabbing entries from two sections and displaying them using the group filter. </p>
  
  <pre><code>{% set entries = craft.entries().section('extendedEvents, festivalEvents')%}
  {% set allEvents = entries %}
  {% set allEventsBySection = allEvents|group('section') %}
  
  {% for section, eventsInSection in allEventsBySection %}
  - results- 
  {% endfor %}
  </code></pre>
  
  <p>No matter what I do the results are coming back ordered as section2 (entry, entry, entry) then section 1 (entry, entry, entry)</p>
  
  <p>How do I affect the order of the sections when displaying the results?                      </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-12T16:48:10.130Z
Comments.Text: Not sure if I got it wrong but what is your goal exactly? Ordering by `orderBy({sectionId: SORT_ASC})` in your main Query?
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-12T17:31:29.027Z
Comments.Text: Thanks, that worked - as there were only two sections I just reversed the arrays in the for loop which also did the job
Comments.UserDisplayName: Kevin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-13T22:04:07.447Z
Comments.Text: @Kevin Can you add your solution as an official answer? Might end up helping someone in the future.
Comments.UserDisplayName: Brad Bell
Tags: <templating><filter><ordering><group>
Title: Grouping entries and ordering by section
ThreadText: # Grouping entries and ordering by section
  
  (Asked by: username_0 on 2019-03-12)
  
  Im grabbing entries from two sections and displaying them using the group filter.
  
  ```
  {% set entries = craft.entries().section('extendedEvents, festivalEvents')%}
  {% set allEvents = entries %}
  {% set allEventsBySection = allEvents|group('section') %}
  
  {% for section, eventsInSection in allEventsBySection %}
  - results- 
  {% endfor %}
  
  ```
  
  No matter what I do the results are coming back ordered as section2 (entry, entry, entry) then section 1 (entry, entry, entry)
  
  How do I affect the order of the sections when displaying the results?
  
  **Tags:** templating, filter, ordering, group
  
  > **Comments:**
  > **username_1**: Not sure if I got it wrong but what is your goal exactly? Ordering by `orderBy({sectionId: SORT_ASC})` in your main Query?  
  > **username_0**: Thanks, that worked - as there were only two sections I just reversed the arrays in the for loop which also did the job  
  > **username_2**: @username_0 Can you add your solution as an official answer? Might end up helping someone in the future.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-03-28. Score: 0 | Accepted answer
  
  The suggestion to order by sectionId resolved my issue here.
  
  {% set entries = craft.entries().section('extendedEvents, festivalEvents'). orderBy({sectionId: SORT\_ASC}) %}
  
  As it was, I was working with two sections, so my quick fix was to simply reverse the order of the output of the for loop...
  
  {% for section, eventsInSection in allEventsBySection | reverse %}
  
  
  ---
  
  