<?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 script&amp;quot; IF/Else trouble in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-script-quot-if-else-trouble/m-p/1668149#M67190</link>
    <description>&lt;P&gt;If you’re running into IF/ELSE trouble in an Arcade script, it usually comes down to syntax issues, incorrect field references, or a logic flow that doesn’t evaluate the way you expect. In Arcade, each condition must be clearly defined, strings must be in quotes &lt;A href="https://getfluxusexecutor.com/" target="_self"&gt;Read more here&lt;/A&gt;, and fields must be wrapped in $feature.fieldname. Also remember that Arcade stops evaluating once it finds a true condition, so ordering your IF/ELSEIF statements correctly is essential.&lt;/P&gt;</description>
    <pubDate>Mon, 24 Nov 2025 10:04:33 GMT</pubDate>
    <dc:creator>Corbinb</dc:creator>
    <dc:date>2025-11-24T10:04:33Z</dc:date>
    <item>
      <title>Arcade script" IF/Else trouble</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-script-quot-if-else-trouble/m-p/1663040#M66935</link>
      <description>&lt;P&gt;I'm having trouble with an if/else statement for an expression that evaluates the intersection of two polygons.&lt;/P&gt;&lt;P&gt;I get the first return, or the correct value(s) for the "if" portion, but nothing for the else portion.&lt;/P&gt;&lt;P&gt;Thanks for any help.&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Aaron Y.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Define a variable to hold the FeatureSet of the intersecting layer.
// Replace "Polygon Layer Name" with the actual name of your polygon layer in the map.
var intersectLayer = FeatureSetByName($map, "Future Land Use Designations");

// Find the features in 'intersectLayer' that intersect the current feature ($feature).
var intersectingFeatures = Intersects(intersectLayer, $feature);

// Initialize an empty array to store the attributes you want to display.
var attributesToDisplay = [];

// Iterate through the intersecting features and extract desired attributes.
// Replace "AttributeField1" and "AttributeField2" with the actual field names from your polygon layer.
for (var f in intersectingFeatures) {
    Push(attributesToDisplay, f['FLUM_Cat']);
}
//Remove square brackets from array and and "/" instead of comma
var myarray = attributesToDisplay;
var arrayasstring = Text(attributesToDisplay);
var nobrakets= Replace(Replace(Replace(arrayasstring, '[', ''), ']', ''),',','/'); 

var NoBracketsDist = Distinct(nobrakets)


// Check if any intersecting features were found.
if (Count(NoBracketsDist) &amp;gt; 0) {
    return "This parcel is within the following Land Use Designation Categories:" + " "+ Concatenate(NoBracketsDist);}

else if (Count(NoBracketsDist) == 0) {
    return "This parcel is outside of the Land Use Designation Categories";
}&lt;/LI-CODE&gt;&lt;P&gt;layers&lt;/P&gt;</description>
      <pubDate>Mon, 03 Nov 2025 23:35:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-script-quot-if-else-trouble/m-p/1663040#M66935</guid>
      <dc:creator>Yeaton</dc:creator>
      <dc:date>2025-11-03T23:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade script" IF/Else trouble</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-script-quot-if-else-trouble/m-p/1663149#M66942</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/553178"&gt;@Yeaton&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that your function here is turning nobrakets into a string, which Distinct needs a list or array, so it's turning your string into a list, so "example" would be e,x,a,m,p,l,e so it's always going to show up wrong.&lt;/P&gt;&lt;P&gt;In this case, I would something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Define a variable to hold the FeatureSet of the intersecting layer.
// Replace "Polygon Layer Name" with the actual name of your polygon layer in the map.
var intersectLayer = FeatureSetByName($map, "Future Land Use Designations");

// Find the features in 'intersectLayer' that intersect the current feature ($feature).
var intersectingFeatures = Intersects(intersectLayer, $feature);

// Initialize an empty array to store the attributes you want to display.
var attributesToDisplay = [];

// Iterate through the intersecting features and extract desired attributes.
// Replace "AttributeField1" and "AttributeField2" with the actual field names from your polygon layer.
for (var f in intersectingFeatures) {
    Push(attributesToDisplay, f['FLUM_Cat']);
}
//Remove square brackets from array and and "/" instead of comma
var myarray = attributesToDisplay;

var NoBracketsDist = Distinct(myarray)

var joined = Concatenate(NoBracketsDist, "/");


// Check if any intersecting features were found.
if (Count(joined) &amp;gt; 0) {
    return "This parcel is within the following Land Use Designation Categories:" + " "+ Concatenate(joined);}

else if (Count(joined) == 0) {
    return "This parcel is outside of the Land Use Designation Categories";
}&lt;/LI-CODE&gt;&lt;P&gt;The Concatenate function can replace the commas with / if you'd like by default, no need to replace, here's the docs for that:&amp;nbsp;&lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/" target="_blank"&gt;https://developers.arcgis.com/arcade/function-reference/text_functions/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Let me know if that helps!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 13:46:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-script-quot-if-else-trouble/m-p/1663149#M66942</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-11-04T13:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade script" IF/Else trouble</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-script-quot-if-else-trouble/m-p/1663309#M66955</link>
      <description>&lt;P&gt;Hi Cody,&lt;/P&gt;&lt;P&gt;Your solution works great! Thanks for the help!&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Aaron&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 18:12:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-script-quot-if-else-trouble/m-p/1663309#M66955</guid>
      <dc:creator>Yeaton</dc:creator>
      <dc:date>2025-11-04T18:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade script" IF/Else trouble</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-script-quot-if-else-trouble/m-p/1668149#M67190</link>
      <description>&lt;P&gt;If you’re running into IF/ELSE trouble in an Arcade script, it usually comes down to syntax issues, incorrect field references, or a logic flow that doesn’t evaluate the way you expect. In Arcade, each condition must be clearly defined, strings must be in quotes &lt;A href="https://getfluxusexecutor.com/" target="_self"&gt;Read more here&lt;/A&gt;, and fields must be wrapped in $feature.fieldname. Also remember that Arcade stops evaluating once it finds a true condition, so ordering your IF/ELSEIF statements correctly is essential.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Nov 2025 10:04:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-script-quot-if-else-trouble/m-p/1668149#M67190</guid>
      <dc:creator>Corbinb</dc:creator>
      <dc:date>2025-11-24T10:04:33Z</dc:date>
    </item>
  </channel>
</rss>

