<?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 expression using Intersect to return fields in popup in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcade-expression-using-intersect-to-return-fields/m-p/1335847#M37367</link>
    <description>&lt;P&gt;You're nearly there! To get the links to come in as clickable links, you need to use an &lt;STRONG&gt;Arcade&lt;/STRONG&gt; popup element.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1696611393518.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82511iAA95ADD1AE6424D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1696611393518.png" alt="jcarlson_0-1696611393518.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You'll want to move that &lt;STRONG&gt;linkArray = &lt;/STRONG&gt;line out of the loop, though, otherwise you'll keep re-assigning it and lose values. That's why you're only getting the last item.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Get the intersecting features from "merged_asbuiltswlinks"
var asBuiltLinksFS = FeatureSetByName(
	$map,
	"merged_asbuiltswlinks",
	['AsBuiltLink'],
	false
)

var allLinks = Intersects($feature, asBuiltLinksFS)

// Initialize an empty array to store the links
var linkArray = []

// Iterate over the intersecting features and add the links to the array
for (var link in allLinks) {
	var l = `&amp;lt;a href="${link.AsBuiltLink}"&amp;gt;${link.AsBuiltLink}&amp;lt;/a&amp;gt;`

	Push(linkArray, l)
}

return { 
	type : 'text', 
	text : Concatenate(linkArray, '\n')
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Oct 2023 17:01:23 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2023-10-06T17:01:23Z</dc:date>
    <item>
      <title>Arcade expression using Intersect to return fields in popup</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcade-expression-using-intersect-to-return-fields/m-p/1335819#M37365</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have two layers - valves (points) and merged_asbuiltswlinks (polygons).&amp;nbsp; In the latter, there are multiple overlapping polygons, each representing the extent of an individual engineering plan.&amp;nbsp; For any given valve, there will be multiple plans that show the particulars of that valve.&amp;nbsp; These are in an Enterprise Portal running 10.9&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;The polygon attribute table has an attribute "asbuiltlink" which contains text (such as http://kcwagis.com/asbuilts/m2-105.pdf&amp;nbsp;)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would like the valve's popup to list out &lt;STRONG&gt;all&lt;/STRONG&gt; asbuiltlink text values for the polygons it intersects (or is within).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Currently the code is only returning one of the intersecting polygon attribute values.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The graphic below shows the extent and overlapping nature of the polygons with the valve.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="overlap.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82506iBCB8799D051F8BEB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="overlap.png" alt="overlap.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;This next graphic shows the popup for the same valve which intersects (or is within) both M2.pdf and M2-105, but you can see the popup is only capturing M2.pdf (the last line).&amp;nbsp; It should also be listing the text for the smaller polygon M2-105&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="popup.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82507i60B33457B8C57063/image-size/medium?v=v2&amp;amp;px=400" role="button" title="popup.png" alt="popup.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there any way to achieve this "full" listing?&amp;nbsp; For some valves, there may be up to 5 or more overlapping polygons they fall within. Here is the current code (written with lots of help from various arcade blogs!):&lt;/P&gt;&lt;P&gt;_______________&lt;/P&gt;&lt;P&gt;var theValveID = $feature.ValveID&lt;BR /&gt;var theValveType = $feature.VALVE_TYPE&lt;BR /&gt;var theValveStatus = $feature.Status&lt;/P&gt;&lt;P&gt;// Get the intersecting features from "merged_asbuiltswlinks"&lt;BR /&gt;var asBuiltLinksFS = FeatureSetByName($map, "merged_asbuiltswlinks", ['AsBuiltLink'], true)&lt;BR /&gt;var allLinks = Intersects($feature, asBuiltLinksFS)&lt;/P&gt;&lt;P&gt;// Initialize an empty array to store the links&lt;BR /&gt;var linkArray = []&lt;/P&gt;&lt;P&gt;// Iterate over the intersecting features and add the links to the array&lt;BR /&gt;for (var link in allLinks) {&lt;BR /&gt;linkArray = Concatenate(linkArray, link.AsBuiltLink, '\n')&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Return the array of links&lt;BR /&gt;return linkArray&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 16:06:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/arcade-expression-using-intersect-to-return-fields/m-p/1335819#M37365</guid>
      <dc:creator>compass_cartographic</dc:creator>
      <dc:date>2023-10-06T16:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression using Intersect to return fields in popup</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcade-expression-using-intersect-to-return-fields/m-p/1335847#M37367</link>
      <description>&lt;P&gt;You're nearly there! To get the links to come in as clickable links, you need to use an &lt;STRONG&gt;Arcade&lt;/STRONG&gt; popup element.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1696611393518.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82511iAA95ADD1AE6424D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1696611393518.png" alt="jcarlson_0-1696611393518.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You'll want to move that &lt;STRONG&gt;linkArray = &lt;/STRONG&gt;line out of the loop, though, otherwise you'll keep re-assigning it and lose values. That's why you're only getting the last item.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Get the intersecting features from "merged_asbuiltswlinks"
var asBuiltLinksFS = FeatureSetByName(
	$map,
	"merged_asbuiltswlinks",
	['AsBuiltLink'],
	false
)

var allLinks = Intersects($feature, asBuiltLinksFS)

// Initialize an empty array to store the links
var linkArray = []

// Iterate over the intersecting features and add the links to the array
for (var link in allLinks) {
	var l = `&amp;lt;a href="${link.AsBuiltLink}"&amp;gt;${link.AsBuiltLink}&amp;lt;/a&amp;gt;`

	Push(linkArray, l)
}

return { 
	type : 'text', 
	text : Concatenate(linkArray, '\n')
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 17:01:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/arcade-expression-using-intersect-to-return-fields/m-p/1335847#M37367</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-10-06T17:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression using Intersect to return fields in popup</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcade-expression-using-intersect-to-return-fields/m-p/1335865#M37368</link>
      <description>&lt;P&gt;THANK YOU Josh!&amp;nbsp; My popups are now working as hoped for!&amp;nbsp; I appreciate this a great deal!&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 17:36:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/arcade-expression-using-intersect-to-return-fields/m-p/1335865#M37368</guid>
      <dc:creator>compass_cartographic</dc:creator>
      <dc:date>2023-10-06T17:36:35Z</dc:date>
    </item>
  </channel>
</rss>

