<?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: Help completing Arcade Script in AGOL to extract data from one layer's field to insert into another layer's field based on intersecting features in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1384479#M57567</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/662145"&gt;@Mowgli_GIS&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I recommend checking out this article by Alix where she provides some sample code for functions like fetching an attribute from a nearby feature.&amp;nbsp;&lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/from-the-smart-editor-to-smart-forms/" target="_blank"&gt;https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/from-the-smart-editor-to-smart-forms/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I hope it helps!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Feb 2024 17:32:38 GMT</pubDate>
    <dc:creator>EmilyGeo</dc:creator>
    <dc:date>2024-02-20T17:32:38Z</dc:date>
    <item>
      <title>Help completing Arcade Script in AGOL to extract data from one layer's field to insert into another layer's field based on intersecting features</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1382891#M57497</link>
      <description>&lt;P&gt;Hello, I'm trying to write a script in Field Maps that will extract a value from a field in one layer and then insert that value into a field in another layer based on snapped/intersecting features.&amp;nbsp; However, I only have a basic understanding of Arcade and am having difficulty formulating a working script (if it's possible?).&amp;nbsp; I found some example of code that I think is what I need, or at least close to what I need but I can't figure out how to tailor it to my needs.&lt;/P&gt;&lt;P&gt;My task is to design where Risers should be placed on Utility Poles, which there is a field in the Riser layer for "Pole ID".&amp;nbsp; So as I'm placing new Risers in the Web map I would like the Riser's "Pole ID" field to auto populate with the corresponding Pole feature ID on which the Riser is snapped.&amp;nbsp; The Riser and Pole are both point features and part of the same Geodatabase which was published as Hosted Feature layer.&amp;nbsp; Below is what I have so far, code is being created within the Riser's "Pole ID" field:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mowgli_GIS_0-1708013525229.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94902iE5F6DB07022B58E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mowgli_GIS_0-1708013525229.png" alt="Mowgli_GIS_0-1708013525229.png" /&gt;&lt;/span&gt;&lt;P&gt;I can't figure out what my return script should be? Or if I should be utilizing completely different approach?&lt;/P&gt;&lt;P&gt;Appreciate any help or insight anyone could offer!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 16:20:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1382891#M57497</guid>
      <dc:creator>Mowgli_GIS</dc:creator>
      <dc:date>2024-02-15T16:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help completing Arcade Script in AGOL to extract data from one layer's field to insert into another layer's field based on intersecting features</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1383208#M57509</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/662145"&gt;@Mowgli_GIS&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're on the right track.&lt;/P&gt;&lt;P&gt;Check out &lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/catch-more-waves-using-arcade-featureset-expressions-in-forms/" target="_self"&gt;this blog post&lt;/A&gt;&amp;nbsp;on using Feature Set/ Intersect for more info and a sample expression.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the sample expression from the post:&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Define a Featureset (zones) from the layer "Zoning Codes" in the $map&lt;BR /&gt;// that contains the attribute ['zone_class']&lt;/P&gt;&lt;P&gt;var zones = FeatureSetByName($map, "Zoning Codes", ['zone_class'])&lt;/P&gt;&lt;P&gt;// Define a variable (code) to store the value we want&lt;BR /&gt;// Get the value by Intersecting the point location&lt;BR /&gt;// with the FeatureSet "Zoning Codes", or zones&lt;/P&gt;&lt;P&gt;var code = First(Intersects($feature, zones))&lt;/P&gt;&lt;P&gt;// If the current location intersects Zoning Codes,&lt;BR /&gt;// return the value in the field ['zone_class'].&lt;BR /&gt;// Otherwise, return a null value for areas where there is no intersecting polygon&lt;/P&gt;&lt;P&gt;if (!IsEmpty(code)) {&lt;BR /&gt;return code['zone_class']&lt;BR /&gt;} else {&lt;BR /&gt;return null&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Hope that helps!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Emily&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 02:04:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1383208#M57509</guid>
      <dc:creator>EmilyGeo</dc:creator>
      <dc:date>2024-02-16T02:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help completing Arcade Script in AGOL to extract data from one layer's field to insert into another layer's field based on intersecting features</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1383514#M57529</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/585739"&gt;@EmilyGeo&lt;/a&gt;&amp;nbsp;, thank you so much for the help!!&amp;nbsp; This is exactly what I needed.&amp;nbsp; I also realized that for scenarios where a point is being snapped to a point, the 'EnvelopeIntersects' function is needed rather than 'Intersects'.&lt;/P&gt;&lt;P&gt;Thank you for the help, really appreciate it!!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 17:29:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1383514#M57529</guid>
      <dc:creator>Mowgli_GIS</dc:creator>
      <dc:date>2024-02-16T17:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help completing Arcade Script in AGOL to extract data from one layer's field to insert into another layer's field based on intersecting features</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1383828#M57540</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/585739"&gt;@EmilyGeo&lt;/a&gt;&amp;nbsp;, sorry to bother you again, but I've hit another wall and cannot wrap my head around the code that is required.&lt;/P&gt;&lt;P&gt;Similar scenario as before, but now I would like the line features created in a Cable layer to pull the Pole ID for the Start and End points of the lines (i.e., Cable A feature starts at Pole 1 feature and ends at Pole 2 feature, and thus the Start ID and End ID fields in the Cable layer would be auto populated with "Pole 1" and "Pole 2").&amp;nbsp; I found some references to "looping" thru the line to acquire this along with the start/end point functions for lines, but I'm struggling to understand.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did use the below, which worked but only for extracting the Pole ID if the Pole point was snapped to a midpoint of the line, it wouldn't extract the ID of the pole where the line started/ended:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Define a Featureset (poles) from the layer "Pole" in the $map&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// that contains the attribute ['ID']&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;poles&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;FeatureSetByName&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$map&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Pole"&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN&gt;'ID'&lt;/SPAN&gt;&lt;SPAN&gt;])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// Define a variable (PoleID) to store the value we want&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Get the value by Intersecting the point location&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// with the FeatureSet "Pole", or poles&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;PoleID&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;First&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;EnvelopeIntersects&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;poles&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// If the current location intersects Pole,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// return the value in the field ['ID'].&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Otherwise, return a null value for areas where there is no intersecting point&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (!&lt;/SPAN&gt;&lt;SPAN&gt;IsEmpty&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;PoleID&lt;/SPAN&gt;&lt;SPAN&gt;)) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;PoleID&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;'ID'&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;} &lt;/SPAN&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;"test"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help you could offer.&amp;nbsp; Thank you!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2024 22:45:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1383828#M57540</guid>
      <dc:creator>Mowgli_GIS</dc:creator>
      <dc:date>2024-02-17T22:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help completing Arcade Script in AGOL to extract data from one layer's field to insert into another layer's field based on intersecting features</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1384479#M57567</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/662145"&gt;@Mowgli_GIS&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I recommend checking out this article by Alix where she provides some sample code for functions like fetching an attribute from a nearby feature.&amp;nbsp;&lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/from-the-smart-editor-to-smart-forms/" target="_blank"&gt;https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/from-the-smart-editor-to-smart-forms/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I hope it helps!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 17:32:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1384479#M57567</guid>
      <dc:creator>EmilyGeo</dc:creator>
      <dc:date>2024-02-20T17:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help completing Arcade Script in AGOL to extract data from one layer's field to insert into another layer's field based on intersecting features</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1384610#M57574</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/585739"&gt;@EmilyGeo&lt;/a&gt;&amp;nbsp;!&amp;nbsp; This looks like it has a lot of very useful info and application to my work flows!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 20:56:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/help-completing-arcade-script-in-agol-to-extract/m-p/1384610#M57574</guid>
      <dc:creator>Mowgli_GIS</dc:creator>
      <dc:date>2024-02-20T20:56:20Z</dc:date>
    </item>
  </channel>
</rss>

