<?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 Sweet for ArcGIS - return multiple features in execution task array in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/sweet-for-arcgis-return-multiple-features-in/m-p/1557292#M62288</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a UK-based user of Sweet for ArcGIS web app builder. I am trying to build a code for the execution task command to add records. While a single feature is a no-brainer, I am struggling with multiple ones.&amp;nbsp; I know that output must be an array of features.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a polygon layer and look for any intersecting polygon features from different layers. I use an empty polygon layer and match fields as a target layer. From the console, I can see that it identifies correct polygons and returns them as an array of x features.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//sssi lay
var intersecting_field = FeatureSetByName($map,"Sites of Special Scientific Interest Units (England)", ['SSSI_NAME'], true);

//intersecting polygons
var intersecting_featset = FeatureSetByName($selection,"Test", ['Project_Code'], true);

//pull feature with geometry from selected polygon
var SelPoly = First(intersecting_featset)

// intersection between selpoly and sssi
var InterPoly = Intersects(intersecting_field, SelPoly)


//array to input results
var SSSIarray = []
var feat;

//loop through intersecting polygons and push to constraints
for(var f in InterPoly) {
    var SSSIfeature = f.SSSI_NAME
        feat = [{
            geometry:  {f,
            attributes: {
                Project_Code: f["SSSI_NAME"],
                Constraint_type: text('SSSI'),
            }
        }}]
        
    Push(SSSIarray, feat) 
}

//find the features in Array
var ReturnValues = Distinct(Splice(SSSIarray))


return ReturnValues;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;From the console, I can see that it identifies correct polygons and returns them as an array of x features. Text output also has correct attributes, including geometries and paired Project Code and SSSI Name.&amp;nbsp; Code executes but nothing is added to the target layer... Any ideas about what may be causing the issue here?&lt;/P&gt;</description>
    <pubDate>Mon, 11 Nov 2024 15:06:44 GMT</pubDate>
    <dc:creator>Julia8</dc:creator>
    <dc:date>2024-11-11T15:06:44Z</dc:date>
    <item>
      <title>Sweet for ArcGIS - return multiple features in execution task array</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/sweet-for-arcgis-return-multiple-features-in/m-p/1557292#M62288</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a UK-based user of Sweet for ArcGIS web app builder. I am trying to build a code for the execution task command to add records. While a single feature is a no-brainer, I am struggling with multiple ones.&amp;nbsp; I know that output must be an array of features.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a polygon layer and look for any intersecting polygon features from different layers. I use an empty polygon layer and match fields as a target layer. From the console, I can see that it identifies correct polygons and returns them as an array of x features.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//sssi lay
var intersecting_field = FeatureSetByName($map,"Sites of Special Scientific Interest Units (England)", ['SSSI_NAME'], true);

//intersecting polygons
var intersecting_featset = FeatureSetByName($selection,"Test", ['Project_Code'], true);

//pull feature with geometry from selected polygon
var SelPoly = First(intersecting_featset)

// intersection between selpoly and sssi
var InterPoly = Intersects(intersecting_field, SelPoly)


//array to input results
var SSSIarray = []
var feat;

//loop through intersecting polygons and push to constraints
for(var f in InterPoly) {
    var SSSIfeature = f.SSSI_NAME
        feat = [{
            geometry:  {f,
            attributes: {
                Project_Code: f["SSSI_NAME"],
                Constraint_type: text('SSSI'),
            }
        }}]
        
    Push(SSSIarray, feat) 
}

//find the features in Array
var ReturnValues = Distinct(Splice(SSSIarray))


return ReturnValues;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;From the console, I can see that it identifies correct polygons and returns them as an array of x features. Text output also has correct attributes, including geometries and paired Project Code and SSSI Name.&amp;nbsp; Code executes but nothing is added to the target layer... Any ideas about what may be causing the issue here?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 15:06:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/sweet-for-arcgis-return-multiple-features-in/m-p/1557292#M62288</guid>
      <dc:creator>Julia8</dc:creator>
      <dc:date>2024-11-11T15:06:44Z</dc:date>
    </item>
  </channel>
</rss>

