<?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 &amp;quot;Test execution error&amp;quot; in Arcade expression in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/quot-test-execution-error-quot-in-arcade/m-p/1305186#M53192</link>
    <description>&lt;P&gt;I'm getting an error when writing an Arcade expression for a pop-up.&lt;/P&gt;&lt;P&gt;I have a table called "Rose Classes" with two fields: "Class" and "Description". I have a feature layer with a field called "Class". The Class field in the table matches the Class field in the feature layer. For a given Class within the feature layer, I want to return the Description for that Class from the Rose Classes table.&lt;/P&gt;&lt;P&gt;I asked ChatGPT for help and got the code below, which outputs "&lt;SPAN&gt;Test execution error: Execution error - Cannot access value using a key of this type. Verify test data.&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;I am very new to Arcade, so I don't even know where to begin to debug this code. I wrote in some return commands and was able to return everything but the final step.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var classesTable = FeatureSetByName($map, 'Rose Classes');
var currentClass = $feature.Class;

var matchingFeatures = Filter(classesTable, 'Class = @currentClass');
var description = '';

if (Count(matchingFeatures) &amp;gt; 0) {
  description = matchingFeatures[0].Description;
}

return description;&lt;/LI-CODE&gt;</description>
    <pubDate>Sun, 02 Jul 2023 22:55:56 GMT</pubDate>
    <dc:creator>swhitcombMCC</dc:creator>
    <dc:date>2023-07-02T22:55:56Z</dc:date>
    <item>
      <title>"Test execution error" in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/quot-test-execution-error-quot-in-arcade/m-p/1305186#M53192</link>
      <description>&lt;P&gt;I'm getting an error when writing an Arcade expression for a pop-up.&lt;/P&gt;&lt;P&gt;I have a table called "Rose Classes" with two fields: "Class" and "Description". I have a feature layer with a field called "Class". The Class field in the table matches the Class field in the feature layer. For a given Class within the feature layer, I want to return the Description for that Class from the Rose Classes table.&lt;/P&gt;&lt;P&gt;I asked ChatGPT for help and got the code below, which outputs "&lt;SPAN&gt;Test execution error: Execution error - Cannot access value using a key of this type. Verify test data.&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;I am very new to Arcade, so I don't even know where to begin to debug this code. I wrote in some return commands and was able to return everything but the final step.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var classesTable = FeatureSetByName($map, 'Rose Classes');
var currentClass = $feature.Class;

var matchingFeatures = Filter(classesTable, 'Class = @currentClass');
var description = '';

if (Count(matchingFeatures) &amp;gt; 0) {
  description = matchingFeatures[0].Description;
}

return description;&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 02 Jul 2023 22:55:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/quot-test-execution-error-quot-in-arcade/m-p/1305186#M53192</guid>
      <dc:creator>swhitcombMCC</dc:creator>
      <dc:date>2023-07-02T22:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: "Test execution error" in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/quot-test-execution-error-quot-in-arcade/m-p/1305254#M53198</link>
      <description>&lt;P&gt;matchingFeatures is a Featureset, a collection of Features. While it would be cool to access the Features by their index, that's not how it works. You can get the First() feature, though.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var classesTable = FeatureSetByName($map, 'Rose Classes')
var currentClass = $feature.Class

var matchingFeature = First(Filter(classesTable, 'Class = @currentClass'))
return IIf(matchingFeature == null, '', matchingFeature.Description)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 03 Jul 2023 10:13:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/quot-test-execution-error-quot-in-arcade/m-p/1305254#M53198</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-07-03T10:13:41Z</dc:date>
    </item>
  </channel>
</rss>

