<?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 Smart Forms Arcade Calculated Expression - Intersects with Sum or GroupBy in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/smart-forms-arcade-calculated-expression/m-p/1327388#M54508</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to write a calculated expression in Smart Forms in AGO Map Viewer.&amp;nbsp; I have polygons with different owner IDs and would like to have the Total Acres attribute in my form to be calculated when the user clicks on the polygon.&amp;nbsp; I have this working correctly, however there are multiple non-adjacent polygons that have the same OwnerID.&amp;nbsp; Is it possible to calculate the Total Acres using Intersects, but summed up for that OwnerID? In the code below, on step 2, instead of returning First, could it return the sum or Total Acres per OwnerID?&lt;/P&gt;&lt;P&gt;I'd like to create a priority list that sorts OwnerID by Total Acres.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// 1. Define the source layer and fields to intersect.
var source_layer = FeatureSetByName($map,"LayerName", ['Acres', 'OwnerID'])

// 2. Intersect the current location with the source layer and get the field value. 
// If there are multiple intersecting features, get the value from the feature that is 
// first returned by the query.
var get_value = First(Intersects($feature, source_layer))

// Step 3. If the current location intersects the source layer, return the value from the source field. 
// Otherwise return null.
if (!IsEmpty(get_value)) {
    return get_value['Acres']}

//GroupedBy expression not used
//var taLayer = GroupBy(get_value, 'OwnerID', { name: 'TAcresPerOwner', expression: 'Acres', statistic: 'SUM' });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;BR /&gt;Melissa&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Sep 2023 17:56:56 GMT</pubDate>
    <dc:creator>M_M</dc:creator>
    <dc:date>2023-09-11T17:56:56Z</dc:date>
    <item>
      <title>Smart Forms Arcade Calculated Expression - Intersects with Sum or GroupBy</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/smart-forms-arcade-calculated-expression/m-p/1327388#M54508</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to write a calculated expression in Smart Forms in AGO Map Viewer.&amp;nbsp; I have polygons with different owner IDs and would like to have the Total Acres attribute in my form to be calculated when the user clicks on the polygon.&amp;nbsp; I have this working correctly, however there are multiple non-adjacent polygons that have the same OwnerID.&amp;nbsp; Is it possible to calculate the Total Acres using Intersects, but summed up for that OwnerID? In the code below, on step 2, instead of returning First, could it return the sum or Total Acres per OwnerID?&lt;/P&gt;&lt;P&gt;I'd like to create a priority list that sorts OwnerID by Total Acres.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// 1. Define the source layer and fields to intersect.
var source_layer = FeatureSetByName($map,"LayerName", ['Acres', 'OwnerID'])

// 2. Intersect the current location with the source layer and get the field value. 
// If there are multiple intersecting features, get the value from the feature that is 
// first returned by the query.
var get_value = First(Intersects($feature, source_layer))

// Step 3. If the current location intersects the source layer, return the value from the source field. 
// Otherwise return null.
if (!IsEmpty(get_value)) {
    return get_value['Acres']}

//GroupedBy expression not used
//var taLayer = GroupBy(get_value, 'OwnerID', { name: 'TAcresPerOwner', expression: 'Acres', statistic: 'SUM' });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;BR /&gt;Melissa&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 17:56:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/smart-forms-arcade-calculated-expression/m-p/1327388#M54508</guid>
      <dc:creator>M_M</dc:creator>
      <dc:date>2023-09-11T17:56:56Z</dc:date>
    </item>
  </channel>
</rss>

