<?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 expressions failing after upgrade in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1632106#M19882</link>
    <description>&lt;P&gt;Esri apparently fixed the bug and my code is working once again.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jul 2025 17:04:04 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2025-07-10T17:04:04Z</dc:date>
    <item>
      <title>arcade expressions failing after upgrade</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630424#M19772</link>
      <description>&lt;P&gt;Any one else experiencing issues with both distinct and filter functions since the last upgrade. Both the samples below were working perfectly then there is an upgrade and they stop. I cannot find any documentation saying they were due to change or be discontinued its baffling.&lt;/P&gt;
&lt;P&gt;Distinct sample&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function housecountinfo() {
  var resdets = FeatureSetById($map, "111111111-layer-82", ["REF", "type1", "Status", "Units", "Studio", "onebed", "twobed", "threebed", "fourbed", "fivebedplus"], True);
  var resact = Intersects($feature, resdets);
  var stats = GroupBy(resact, [{ name: "Ref", expression: "Ref" }, { name: "type", expression: "type1" }, { name: "Status", expression: "Status" }], 
                      [{ name: "Units", expression: "Units", statistic: "SUM" }, { name: "studio", expression: "studio", statistic: "SUM" }, { name: "onebed", expression: "onebed", statistic: "Sum" }, 
                       { name: "twobed", expression: "twobed", statistic: "Sum" }, { name: "threebed", expression: "threebed", statistic: "Sum" }, { name: "fourbed", expression: "fourbed", statistic: "Sum" }, 
                       { name: "fivebedplus", expression: "fivebedplus", statistic: "Sum" }]);

  if (Count(stats) &amp;gt; 0) {
    var uniqueRefs = Distinct(stats, "Ref");
    var result = [];
    for (var ref in uniqueRefs) {
      var x = ref.Ref;
      var filteredStats = Filter(stats, "Ref = @x");

      var hncud = createUnitDict(filteredStats, 1, 1);
      var ancud = createUnitDict(filteredStats, 2, 1);
      var dncud = createUnitDict(filteredStats, 3, 1);
      var hucud = createUnitDict(filteredStats, 1, 2);
      var aucud = createUnitDict(filteredStats, 2, 2);
      var ducud = createUnitDict(filteredStats, 3, 2);
      var hcud = createUnitDict(filteredStats, 1, 3);
      var acud = createUnitDict(filteredStats, 2, 3);
      var dcud = createUnitDict(filteredStats, 3, 3);

      var hcdata = {
        ref: x,
        Notcommenced: { summary: hncud.units + ancud.units + dncud.units },
        Underconstruction: { summary: hucud.units + aucud.units + ducud.units },
        Completed: { summary: hcud.units + dcud.units + acud.units },
        unitbreakdown: {
          astudio: [hncud.studio, ancud.studio, dncud.studio, hucud.studio, aucud.studio, ducud.studio, hcud.studio, acud.studio, dcud.studio],
          bonebed: [hncud.onebed, ancud.onebed, dncud.onebed, hucud.onebed, aucud.onebed, ducud.onebed, hcud.onebed, acud.onebed, dcud.onebed],
          ctwobed: [hncud.twobed, ancud.twobed, dncud.twobed, hucud.twobed, aucud.twobed, ducud.twobed, hcud.twobed, acud.twobed, dcud.twobed],
          dthreebed: [hncud.threebed, ancud.threebed, dncud.threebed, hucud.threebed, aucud.threebed, ducud.threebed, hcud.threebed, acud.threebed, dcud.threebed],
          efourbed: [hncud.fourbed, ancud.fourbed, dncud.fourbed, hucud.fourbed, aucud.fourbed, ducud.fourbed, hcud.fourbed, acud.fourbed, dcud.fourbed],
          ffivebedplus: [hncud.fivebedplus, ancud.fivebedplus, dncud.fivebedplus, hucud.fivebedplus, aucud.fivebedplus, ducud.fivebedplus, hcud.fivebedplus, acud.fivebedplus, dcud.fivebedplus]
        }
      };
      Push(result, hcdata);
    }
    return result;
  } else {
    return 9999;
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and filter sample&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function createUnitDict(filteredStats, type, status) {
  var filtered = First(Filter(filteredStats, "type = @type AND Status = @status"));
  if (IsEmpty(filtered)) {
    return { units: 0, studio: 0, onebed: 0, twobed: 0, threebed: 0, fourbed: 0, fivebedplus: 0 };
  } else {
    return { units: filtered.Units, studio: filtered.studio, onebed: filtered.onebed, twobed: filtered.twobed, threebed: filtered.threebed, fourbed: filtered.fourbed, fivebedplus: filtered.fivebedplus };
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jul 2025 22:23:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630424#M19772</guid>
      <dc:creator>LarryMcEvoy70</dc:creator>
      <dc:date>2025-07-06T22:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: arcade expressions failing after upgrade</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630425#M19773</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/437577"&gt;@LarryMcEvoy70&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you say they stopped working, what errors does this produce when you run? Also, What kind of upgrade was performed, from what version to what version?&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2025 16:37:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630425#M19773</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-07-04T16:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: arcade expressions failing after upgrade</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630429#M19774</link>
      <description>&lt;P&gt;Hi Cody,&lt;/P&gt;&lt;P&gt;Its all up on AGOL so whatever they did last week, didn't have time to investigate it until now because I was fixing other stuff that broke, The error for what its worth is&amp;nbsp;&lt;SPAN&gt;Test execution error: Encountered unreachable logic. Verify test data. Debugging arcade is slow and tedious but found I was getting no return for the distinct so rewrote that section and then I discovered the filter was not fiving a return either so will have to rewrite that section as well. I always thought that the idea behind documented built in functions was that they worked consistently and you got warned about depreciation.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ta&lt;/P&gt;&lt;P&gt;Larry&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2025 17:38:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630429#M19774</guid>
      <dc:creator>LarryMcEvoy70</dc:creator>
      <dc:date>2025-07-04T17:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: arcade expressions failing after upgrade</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630443#M19775</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 428px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/135935i36227F1EE7CD5384/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;After a fairly substantial rewrite to add in a distinct and filter outside of the functions it is back working again. Does this actually need to happen from my viewpoint ESRI pushed a release out early&amp;nbsp; in order to wave their shiny new toys at a user conference. We all like new features that help to make work easier but please stop breaking stuff that was working and maybe try a little testing before you do push a release.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2025 21:11:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630443#M19775</guid>
      <dc:creator>LarryMcEvoy70</dc:creator>
      <dc:date>2025-07-04T21:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: arcade expressions failing after upgrade</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630673#M19785</link>
      <description>&lt;P&gt;I am also experiencing errors in my code since the June 2025 update, which also uses Distinct and Filters. I've submitted a case to Esri, but what does your new code look like?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jul 2025 15:00:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630673#M19785</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-07-07T15:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: arcade expressions failing after upgrade</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630721#M19786</link>
      <description>&lt;LI-CODE lang="javascript"&gt;if (Count(statsArray) &amp;gt; 0) {
    var uniqueRefs = [];
    var seenRefs = [];

    for (var i = 0; i &amp;lt; Count(statsArray); i++) {
      var s = statsArray[i];
      Console("Processing stat:", s);
      if (HasKey(s, "ref")) {
        var refVal = s["ref"];

        if (IndexOf(seenRefs, refVal) == -1) {
          Push(seenRefs, refVal);
          Push(uniqueRefs, { ref: refVal });
        }
      }
    }&lt;/LI-CODE&gt;&lt;P&gt;The above replaced the distinct&lt;/P&gt;&lt;P&gt;And lucky enough I was only filtering by a unique ref so the below worked for me on the filter, I have also asked our GIS people to log a case with Esri so hopefully there is a simple fix that will sort it.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;for (var j = 0; j &amp;lt; Count(uniqueRefs); j++) {
      var x = uniqueRefs[j]["ref"];

      var filteredStats = [];

      for (var k = 0; k &amp;lt; Count(statsArray); k++) {
        var s = statsArray[k];
        if (HasKey(s, "ref") &amp;amp;&amp;amp; s["ref"] == x) {
          Push(filteredStats, s);
        }
      }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jul 2025 16:14:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1630721#M19786</guid>
      <dc:creator>DrawingOffice</dc:creator>
      <dc:date>2025-07-07T16:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: arcade expressions failing after upgrade</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1631052#M19818</link>
      <description>&lt;P&gt;Thank you for the expression examples, it has helped us narrow down and isolate this issue.&amp;nbsp; Just to clarify this was not an intended change in behavior.&amp;nbsp; We're hoping to roll this out as a fix in the next few days.&amp;nbsp; The bug itself impacts a few specific usage patterns of featureSets.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jul 2025 11:19:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1631052#M19818</guid>
      <dc:creator>PaulBarker</dc:creator>
      <dc:date>2025-07-08T11:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: arcade expressions failing after upgrade</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1632106#M19882</link>
      <description>&lt;P&gt;Esri apparently fixed the bug and my code is working once again.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jul 2025 17:04:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/arcade-expressions-failing-after-upgrade/m-p/1632106#M19882</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-07-10T17:04:04Z</dc:date>
    </item>
  </channel>
</rss>

