<?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: Arcade: Decode within GroupBy exression in ArcGIS Online Developers Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-decode-within-groupby-exression/m-p/1502172#M1420</link>
    <description>&lt;P&gt;Brilliant, thank you!&lt;/P&gt;</description>
    <pubDate>Sun, 07 Jul 2024 04:45:26 GMT</pubDate>
    <dc:creator>AlexandHall95</dc:creator>
    <dc:date>2024-07-07T04:45:26Z</dc:date>
    <item>
      <title>Arcade: Decode within GroupBy exression</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-decode-within-groupby-exression/m-p/1502088#M1418</link>
      <description>&lt;P&gt;Hopefully someone has some advice, I have a a bit of arcade that I can't seem to get to work. The arcade script runs eternally without returning a result:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;GroupBy&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;filteredFs&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; [&lt;/SPAN&gt;&lt;SPAN&gt;'lead_contractor_name'&lt;/SPAN&gt;&lt;SPAN&gt;],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; [&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/SPAN&gt;&lt;SPAN&gt;name&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;'failed_count'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;expression&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;'Decode(state, "FAILED", 1, 0)'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;statistic&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;'SUM'&lt;/SPAN&gt;&lt;SPAN&gt;},&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/SPAN&gt;&lt;SPAN&gt;name&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;'successful_count'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;expression&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;'Decode(state, "SUCCESSFUL", 1, 0)'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;statistic&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;'SUM'&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I have done some debugging and the filteredFs returns as expected, however when attempting to return the GroupBy output, nothing is returned and no errors are flagged.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 06 Jul 2024 11:26:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-decode-within-groupby-exression/m-p/1502088#M1418</guid>
      <dc:creator>AlexandHall95</dc:creator>
      <dc:date>2024-07-06T11:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Decode within GroupBy exression</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-decode-within-groupby-exression/m-p/1502090#M1419</link>
      <description>&lt;P&gt;GroupBy is one of those functions that uses SQL. The value of &lt;STRONG&gt;expression &lt;/STRONG&gt;has to be a valid SQL expression, not Arcade. Thankfully, Decode is something we can easily replicate in SQL using a CASE statement.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return GroupBy(
    filteredFs,
    ['lead_contractor_name'],
    [
        {name: 'failed_count', expression: "CASE WHEN state = 'FAILED' THEN 1 ELSE 0 END", statistic: 'SUM'},
        {name: 'successful_count', expression: "CASE WHEN state = 'SUCCESSFUL' THEN 1 ELSE 0 END", statistic: 'SUM'}
    ]
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jul 2024 13:38:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-decode-within-groupby-exression/m-p/1502090#M1419</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-07-06T13:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade: Decode within GroupBy exression</title>
      <link>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-decode-within-groupby-exression/m-p/1502172#M1420</link>
      <description>&lt;P&gt;Brilliant, thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jul 2024 04:45:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-developers-questions/arcade-decode-within-groupby-exression/m-p/1502172#M1420</guid>
      <dc:creator>AlexandHall95</dc:creator>
      <dc:date>2024-07-07T04:45:26Z</dc:date>
    </item>
  </channel>
</rss>

