<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Looking for an Arcade expression that will query Census tract language spoken fields (40 fields) and return the highest 6 languages and their %s in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/looking-for-an-arcade-expression-that-will-query/m-p/1256959#M50284</link>
    <description>&lt;P&gt;Popup pie charts will need an expression for &lt;EM&gt;each&lt;/EM&gt; slice, but you can re-use the following expression:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;# array of language fields
var lang_arr = [
    $feature.language1,
    $feature.language2,
    ...
    $feature.language40
]

# sort the array largest to smallest
var lang_sorted = Reverse(Sort(lang_arr))

# grab the top item
return lang_sorted[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;Sort&lt;/STRONG&gt; will, by default, sort in &lt;EM&gt;ascending &lt;/EM&gt;order. You could write a custom sort function, but it's simpler to just wrap it in &lt;STRONG&gt;Reverse&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;When using this expression for successive items, just change the number in the last line. Arrays are 0-indexed, so returning &lt;STRONG&gt;lang_sorted[1] &lt;/STRONG&gt;would be the second-highest number, &lt;STRONG&gt;lang_sorted[2]&lt;/STRONG&gt; third-highest, and so on.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Feb 2023 13:02:53 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2023-02-10T13:02:53Z</dc:date>
    <item>
      <title>Looking for an Arcade expression that will query Census tract language spoken fields (40 fields) and return the highest 6 languages and their %s</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/looking-for-an-arcade-expression-that-will-query/m-p/1256817#M50280</link>
      <description>&lt;P&gt;The goal is to take to the results of the above expression and use populate a pie chart using ArcGIS Online Map Viewer Classic, Popup, Arcade Expression and pie chart. So if one clicks on any Census tract, they would see standard pop up attributes and pie chart showing the higher 6 spoken languages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;See example of the Census tract data with&amp;nbsp;9 of the 40 languages&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnEsch1_0-1675987114039.png" style="width: 699px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/62523iF8561C7633E458F1/image-dimensions/699x194?v=v2" width="699" height="194" role="button" title="JohnEsch1_0-1675987114039.png" alt="JohnEsch1_0-1675987114039.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;John Esch&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 00:02:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/looking-for-an-arcade-expression-that-will-query/m-p/1256817#M50280</guid>
      <dc:creator>JohnEsch1</dc:creator>
      <dc:date>2023-02-10T00:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for an Arcade expression that will query Census tract language spoken fields (40 fields) and return the highest 6 languages and their %s</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/looking-for-an-arcade-expression-that-will-query/m-p/1256959#M50284</link>
      <description>&lt;P&gt;Popup pie charts will need an expression for &lt;EM&gt;each&lt;/EM&gt; slice, but you can re-use the following expression:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;# array of language fields
var lang_arr = [
    $feature.language1,
    $feature.language2,
    ...
    $feature.language40
]

# sort the array largest to smallest
var lang_sorted = Reverse(Sort(lang_arr))

# grab the top item
return lang_sorted[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;Sort&lt;/STRONG&gt; will, by default, sort in &lt;EM&gt;ascending &lt;/EM&gt;order. You could write a custom sort function, but it's simpler to just wrap it in &lt;STRONG&gt;Reverse&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;When using this expression for successive items, just change the number in the last line. Arrays are 0-indexed, so returning &lt;STRONG&gt;lang_sorted[1] &lt;/STRONG&gt;would be the second-highest number, &lt;STRONG&gt;lang_sorted[2]&lt;/STRONG&gt; third-highest, and so on.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 13:02:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/looking-for-an-arcade-expression-that-will-query/m-p/1256959#M50284</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-02-10T13:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for an Arcade expression that will query Census tract language spoken fields (40 fields) and return the highest 6 languages and their %s</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/looking-for-an-arcade-expression-that-will-query/m-p/1266888#M50845</link>
      <description>&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2023 13:18:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/looking-for-an-arcade-expression-that-will-query/m-p/1266888#M50845</guid>
      <dc:creator>JohnEsch1</dc:creator>
      <dc:date>2023-03-12T13:18:18Z</dc:date>
    </item>
  </channel>
</rss>

