<?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: Groupby Function in Arcade in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1314562#M53700</link>
    <description>&lt;P&gt;You have a typo. It's "statistic" not "statistics"&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;GroupBy($layer, 'COUNTRY', { name:'NumberS', expression:'Title', statistic:'COUNT'})&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 02 Aug 2023 14:02:35 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2023-08-02T14:02:35Z</dc:date>
    <item>
      <title>Groupby Function in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1314534#M53698</link>
      <description>&lt;P&gt;I have a dataset that includes a list of countries with the different studies done in those countries, and I want to auto calculate the number of studies per country in a new field.&lt;/P&gt;&lt;P&gt;I have used the Arcade GroupBY function as follows: GroupBy($layer,'COUNTRY',&amp;nbsp;{name:'NumberS', expression:'Title', statistic:'COUNT'})&lt;/P&gt;&lt;P&gt;And I get this error: &lt;STRONG&gt;Cannot insert Object in Integer field.&amp;nbsp;&lt;SPAN&gt;You can review the error in the script editor and try the calculation again, or cancel this calculation without changing any data.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 14:49:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1314534#M53698</guid>
      <dc:creator>Mokwena9</dc:creator>
      <dc:date>2023-08-02T14:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Groupby Function in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1314562#M53700</link>
      <description>&lt;P&gt;You have a typo. It's "statistic" not "statistics"&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;GroupBy($layer, 'COUNTRY', { name:'NumberS', expression:'Title', statistic:'COUNT'})&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 02 Aug 2023 14:02:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1314562#M53700</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-08-02T14:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Groupby Function in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1314585#M53702</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;Thank you I have fixed that, but I still get an error&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 14:52:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1314585#M53702</guid>
      <dc:creator>Mokwena9</dc:creator>
      <dc:date>2023-08-02T14:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Groupby Function in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1314586#M53703</link>
      <description>&lt;P&gt;Are you getting the same error or a different one?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 14:54:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1314586#M53703</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-08-02T14:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Groupby Function in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1315414#M53742</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;&lt;SPAN&gt;I get this error:&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Cannot insert Object in Integer field.&amp;nbsp;&lt;SPAN&gt;You can review the error in the script editor and try the calculation again, or cancel this calculation without changing any data.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 07:08:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1315414#M53742</guid>
      <dc:creator>Mokwena9</dc:creator>
      <dc:date>2023-08-04T07:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Groupby Function in Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1315517#M53752</link>
      <description>&lt;P&gt;Without seeing your full code, it sounds like you're trying to save the results of the GroupBy function to your field. GroupBy returns a FeatureSet, which is an object. You have to get the count value from that FeatureSet to save to your field. This is an example from the Playground that shows different ways of getting the GroupBy count for either the &lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#first" target="_self"&gt;first&lt;/A&gt; record in the FeatureSet or a specific record.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem(
  Portal("https://www.arcgis.com"),
  // portal item id
  "6200db0b80de4341ae8ee2b62d606e67",
  0, // layer id
  ["*"], // fields to include
  true // include or exclude geometry
);

//Get the count of how many records for each floor value
var group = GroupBy(fs, 'FLOORCOUNT', {name: 'Floors', expression: '1', statistic: 'Count'})

//return just the first record
//return firstRec = First(group).Floors

//return the count for a specific floor (3)
return First(Filter(group, 'FLOORCOUNT = 3')).Floors&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Aug 2023 14:11:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/groupby-function-in-arcade/m-p/1315517#M53752</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-08-04T14:11:33Z</dc:date>
    </item>
  </channel>
</rss>

