<?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/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>
    <dc:creator>CodyPatterson</dc:creator>
    <dc:date>2025-11-04T13:46:26Z</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>
    <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/1708814#M68903</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Hey Aaron,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Great question – I've run into this exact behaviour before. The issue is likely that your &lt;/SPAN&gt;else&lt;SPAN class=""&gt; condition (&lt;/SPAN&gt;Count(NoBracketsDist) == 0&lt;SPAN class=""&gt;) never evaluates to &lt;/SPAN&gt;true&lt;SPAN class=""&gt; because &lt;/SPAN&gt;NoBracketsDist&lt;SPAN class=""&gt; is an empty string (&lt;/SPAN&gt;''&lt;SPAN class=""&gt;) rather than an empty array. So &lt;/SPAN&gt;Count()&lt;SPAN class=""&gt; on a string that's empty still returns something (often &lt;/SPAN&gt;0&lt;SPAN class=""&gt; in some contexts), but the logic flow might be skipping it because of how &lt;/SPAN&gt;Distinct()&lt;SPAN class=""&gt; works on empty data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Here's a cleaner approach:&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;javascript&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; intersecting &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;Intersects&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;FeatureSetByName&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;$map&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;"Future Land Use Designations"&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; $feature&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; cats &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;]&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;

&lt;SPAN&gt;&lt;SPAN class=""&gt;for&lt;/SPAN&gt; &lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; f &lt;SPAN class=""&gt;in&lt;/SPAN&gt; intersecting&lt;SPAN class=""&gt;)&lt;/SPAN&gt; &lt;SPAN class=""&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;    &lt;SPAN class=""&gt;Push&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;cats&lt;SPAN class=""&gt;,&lt;/SPAN&gt; f&lt;SPAN class=""&gt;[&lt;/SPAN&gt;&lt;SPAN class=""&gt;'FLUM_Cat'&lt;/SPAN&gt;&lt;SPAN class=""&gt;]&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;

&lt;SPAN&gt;&lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;Count&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;cats&lt;SPAN class=""&gt;)&lt;/SPAN&gt; &lt;SPAN class=""&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;0&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt; &lt;SPAN class=""&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;    &lt;SPAN class=""&gt;var&lt;/SPAN&gt; cleaned &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;Concatenate&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;Distinct&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;cats&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;    &lt;SPAN class=""&gt;// Replacing commas with slashes&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;    &lt;SPAN class=""&gt;var&lt;/SPAN&gt; formatted &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;Replace&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;Replace&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;cleaned&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;','&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;'/'&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;' '&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;' '&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;    &lt;SPAN class=""&gt;return&lt;/SPAN&gt; &lt;SPAN class=""&gt;"This parcel is within the following Land Use Designation Categories: "&lt;/SPAN&gt; &lt;SPAN class=""&gt;+&lt;/SPAN&gt; formatted&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;}&lt;/SPAN&gt; &lt;SPAN class=""&gt;else&lt;/SPAN&gt; &lt;SPAN class=""&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;    &lt;SPAN class=""&gt;return&lt;/SPAN&gt; &lt;SPAN class=""&gt;"This parcel is outside of the Land Use Designation Categories"&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Notice:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Check &lt;/SPAN&gt;intersecting&lt;SPAN class=""&gt; count &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;before&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt; manipulating strings.&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Use &lt;/SPAN&gt;Concatenate()&lt;SPAN class=""&gt; directly on distinct values.&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Avoid converting to string earlier – it creates empty string issues.&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;This reminds me of &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Xeno Executor&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt; troubleshooting – sometimes the simplest condition (like whether a &lt;A href="https://xeno-executordl.com/xeno-scripts/" target="_blank" rel="noopener"&gt;script&lt;/A&gt; actually injected) gets buried under formatting and extra steps. Strip it back, check the base result first, and handle the empty case cleanly. Hope this helps!&lt;/SPAN&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 18 Jun 2026 11:59:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-script-quot-if-else-trouble/m-p/1708814#M68903</guid>
      <dc:creator>halicoptis</dc:creator>
      <dc:date>2026-06-18T11:59:23Z</dc:date>
    </item>
  </channel>
</rss>

