title: FreeMarker template - Double sorting
body: <p>I am working on FreeMarker template for creating chart outputs using HighChart and we have a requirement to do double sorting based on 2 different columns.</p>
  
  <p>Example: <em>Sorting country list using 2 different columns "Region" and "Country"</em></p>
  
  <p>I checked other forums and found double sorting has been defined within array elements as specified below but not at an individual element level.</p>
  
  <pre><code>current.children?sort_by('type')?sort_by(['properties','cm:name'])
  </code></pre>
  
  <p>Here is the code snippet</p>
  
  <pre><code>&lt;#--Assign the array values--&gt;
  
  &lt;#assign country = country +  [ {
      "category":"${level1}",
      "value":level1Value?number,
      "color": color?string,
      "superRegion":"${level3?upper_case}",
      "region":"${level2?upper_case}"
  } ] &gt;
  </code></pre>
  
  <p>Sorting the list - The below double sorting doesn't work. Does anyone know how to do this double sorting ?</p>
  
  <pre><code>&lt;#list country?sort_by("superRegion")?reverse?sort_by("region") as countrySorted&gt;
  </code></pre>