<?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: Overwrite Coded Text Values with Different Text String on Intersect in Arcade Expression in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526374#M14470</link>
    <description>&lt;P&gt;Where is the screenshot expression from? It's different from the text you posted… I wouldn't trust it, as &lt;STRONG&gt;Filter&lt;/STRONG&gt; is for attribute-based selections. The function &lt;STRONG&gt;Intersects&lt;/STRONG&gt; will spatially filter the other layer all by itself. Also, even though Arcade acts a lot like JS, it has no switch/case capabilities.&lt;/P&gt;&lt;P&gt;You'll need to change the expression, but switch/case can nicely be replaced with the function &lt;STRONG&gt;When&lt;/STRONG&gt;. Or when you're just swapping one value for possible others, &lt;STRONG&gt;Decode&lt;/STRONG&gt;.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Variables for the layers
var point = $feature;
var polygons = FeatureSetByName($map, "COG Zoning");

// Initialize the output string
var result = "No intersection";

// Loop through polygons to check intersection
for (var poly in polygons) {
    if (Intersects(point, poly)) {
        // Customize this part to return specific text based on polygon attributes
        result = Decode(
            poly.Pro_Zoning,
            'RR', "Residential",
            'CG', "Commercial",
            // Add more cases as needed
            "Zoning data is not available"
        )
    }
}

// Return the result string
return result;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Aug 2024 12:36:22 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2024-08-23T12:36:22Z</dc:date>
    <item>
      <title>Overwrite Coded Text Values with Different Text String on Intersect in Arcade Expression</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526370#M14469</link>
      <description>&lt;P&gt;Hi, I am attempting to create an attribute expression through an address point layer that intersects a zoning layer. The zone layer has an attribute that is coded with different zones, i.e. "RR" for residential, "CG" for commercial. I'm using Intersect to find the polygon layer and retrieve the attribute but having an issue with re-writing the return result. I used the code below but am having an issue with the open brace { at the switch line in code below (line 10 in the image). Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;// Variables for the layers&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;point&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;polygons&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;"COG Zoning"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;// Initialize the output string&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;result&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"No intersection"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;// Loop through polygons to check intersection&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;poly &lt;/SPAN&gt;&lt;SPAN&gt;in &lt;/SPAN&gt;&lt;SPAN&gt;polygons&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;Intersects&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;point&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;poly&lt;/SPAN&gt;&lt;SPAN&gt;)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Customize this part to return specific text based on polygon attributes&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;switch&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;poly&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Pro_Zoning&lt;/SPAN&gt;&lt;SPAN&gt;) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;case &lt;/SPAN&gt;&lt;SPAN&gt;"RR"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;result&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Residential"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;break&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;case &lt;/SPAN&gt;&lt;SPAN&gt;"CG"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;result&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Commercial"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;break&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Add more cases as needed&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;default&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;result&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Zoning data is not available"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;// Return the result string&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;return &lt;/SPAN&gt;&lt;SPAN&gt;result&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-08-23 083243.png" style="width: 989px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/113343i63D458F48996A10F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-08-23 083243.png" alt="Screenshot 2024-08-23 083243.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 12:33:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526370#M14469</guid>
      <dc:creator>DanE897645198</dc:creator>
      <dc:date>2024-08-23T12:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Coded Text Values with Different Text String on Intersect in Arcade Expression</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526374#M14470</link>
      <description>&lt;P&gt;Where is the screenshot expression from? It's different from the text you posted… I wouldn't trust it, as &lt;STRONG&gt;Filter&lt;/STRONG&gt; is for attribute-based selections. The function &lt;STRONG&gt;Intersects&lt;/STRONG&gt; will spatially filter the other layer all by itself. Also, even though Arcade acts a lot like JS, it has no switch/case capabilities.&lt;/P&gt;&lt;P&gt;You'll need to change the expression, but switch/case can nicely be replaced with the function &lt;STRONG&gt;When&lt;/STRONG&gt;. Or when you're just swapping one value for possible others, &lt;STRONG&gt;Decode&lt;/STRONG&gt;.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Variables for the layers
var point = $feature;
var polygons = FeatureSetByName($map, "COG Zoning");

// Initialize the output string
var result = "No intersection";

// Loop through polygons to check intersection
for (var poly in polygons) {
    if (Intersects(point, poly)) {
        // Customize this part to return specific text based on polygon attributes
        result = Decode(
            poly.Pro_Zoning,
            'RR', "Residential",
            'CG', "Commercial",
            // Add more cases as needed
            "Zoning data is not available"
        )
    }
}

// Return the result string
return result;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 12:36:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526374#M14470</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-08-23T12:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Coded Text Values with Different Text String on Intersect in Arcade Expression</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526377#M14471</link>
      <description>&lt;P&gt;Hi Josh, it was my mistake. I had included a different image for the question. The correct image has been updated on the post and attached here&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-08-23 083243.png" style="width: 989px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/113344iFF207B4B8A08C515/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-08-23 083243.png" alt="Screenshot 2024-08-23 083243.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 12:40:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526377#M14471</guid>
      <dc:creator>DanE897645198</dc:creator>
      <dc:date>2024-08-23T12:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Coded Text Values with Different Text String on Intersect in Arcade Expression</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526410#M14473</link>
      <description>&lt;P&gt;And did you try swapping the switch/case for Decode?&lt;/P&gt;&lt;P&gt;Also, rather than loop through the entire polygons layer and checking for intersection with your point, you're better off doing it the other way. Using &lt;STRONG&gt;Intersects&lt;/STRONG&gt; between your point and the entire polygons layer will return a FeatureSet of only those polygons which intersect with the point.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var intersecting_polygons = Intersects($feature, FeatureSetByName($map, 'COG Zoning'))

// if intersection, decode value, otherwise return "no intersection"
if (Count(intersecting_polygons) &amp;gt; 0) {
  var poly = First(intersecting_polygons)
  return Decode(
    poly.Pro_Zoning,
    'RR', 'Residential',
    'CG', 'Commercial',
    //etc
    'Zoning data not available'
  )
} else {
  return 'No intersecting zoning feature'
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 13:49:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526410#M14473</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-08-23T13:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Coded Text Values with Different Text String on Intersect in Arcade Expression</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526425#M14474</link>
      <description>&lt;P&gt;Hi Josh,&lt;/P&gt;&lt;P&gt;I tried the first set of code but kept receiving the "No Intersection" result even though the polygon layer intersected had an attribute. But your second set of code worked perfectly. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 14:06:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1526425#M14474</guid>
      <dc:creator>DanE897645198</dc:creator>
      <dc:date>2024-08-23T14:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite Coded Text Values with Different Text String on Intersect in Arcade Expression</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1535072#M14698</link>
      <description>&lt;P&gt;Hi Josh,&lt;/P&gt;&lt;P&gt;A follow up question for this. What if I'm using multiple polygon layers? Meaning one polygon for the city and another polygon for the county.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 17:13:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/overwrite-coded-text-values-with-different-text/m-p/1535072#M14698</guid>
      <dc:creator>DanE897645198</dc:creator>
      <dc:date>2024-09-04T17:13:12Z</dc:date>
    </item>
  </channel>
</rss>

