<?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 Experience Builder Arcade Code Error &amp;quot;Cannot access value using a key of this type&amp;quot; in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/experience-builder-arcade-code-error-quot-cannot/m-p/1695853#M68397</link>
    <description>&lt;P&gt;Here is my code to sum the length field times the width field to get the total area for line features.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;fs&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;$dataSources&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"dataSource_1-19d7400ea8f-layer-20"&lt;/SPAN&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;total&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;for&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;f&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;fs&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/S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AN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;I get the "Cannot access value using a key of this type." error, but can't figure out how to fix.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 13 Apr 2026 16:36:36 GMT</pubDate>
    <dc:creator>TimWill</dc:creator>
    <dc:date>2026-04-13T16:36:36Z</dc:date>
    <item>
      <title>Experience Builder Arcade Code Error "Cannot access value using a key of this type"</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/experience-builder-arcade-code-error-quot-cannot/m-p/1695853#M68397</link>
      <description>&lt;P&gt;Here is my code to sum the length field times the width field to get the total area for line features.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;fs&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;$dataSources&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"dataSource_1-19d7400ea8f-layer-20"&lt;/SPAN&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;total&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;for&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;f&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;fs&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/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lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;total&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;I get the "Cannot access value using a key of this type." error, but can't figure out how to fix.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 13 Apr 2026 16:36:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/experience-builder-arcade-code-error-quot-cannot/m-p/1695853#M68397</guid>
      <dc:creator>TimWill</dc:creator>
      <dc:date>2026-04-13T16:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Experience Builder Arcade Code Error "Cannot access value using a key of this type"</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/experience-builder-arcade-code-error-quot-cannot/m-p/1695867#M68398</link>
      <description>&lt;P data-unlink="true"&gt;The first line of your script doesn't return a FeatureSet, but rather a &lt;A href="https://developers.arcgis.com/arcade/profiles/experience-builder-widget-formatting/#profile-variables" target="_self"&gt;dictionary&lt;/A&gt;. You have to use the layer property to get the features from $dataSource.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = $dataSources["dataSource_1-19d7400ea8f-layer-20"].layer;
var total = 0;
for (var f in fs) {
  var len_in_inches = f.Shape.STLength() * 12;
  var width_in_inches = Number(f.Width_Inches, 0);
  total += width_in_inches * len_in_inches;
}
return total;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 17:11:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/experience-builder-arcade-code-error-quot-cannot/m-p/1695867#M68398</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2026-04-13T17:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Experience Builder Arcade Code Error "Cannot access value using a key of this type"</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/experience-builder-arcade-code-error-quot-cannot/m-p/1695870#M68399</link>
      <description>&lt;P&gt;Thanks for the response. I am getting a new error with the f.Shape callout.&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;Key not found - Shape."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Not sure why, but I did notice your code only has the STLength() in red and not the entire name.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My field is the esri feature class field Shape.STLength() field.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance for any additional assistance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 17:13:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/experience-builder-arcade-code-error-quot-cannot/m-p/1695870#M68399</guid>
      <dc:creator>TimWill</dc:creator>
      <dc:date>2026-04-13T17:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Experience Builder Arcade Code Error "Cannot access value using a key of this type"</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/experience-builder-arcade-code-error-quot-cannot/m-p/1695930#M68403</link>
      <description>&lt;P&gt;I use the JavaScript language selection in the code sample window for Arcade code, which highlights code in a different way than the language that you selected.&lt;/P&gt;&lt;P&gt;When working with a normal FeatureSet, you should be able to return the length of a feature using "f.Shape_Leng". If that doesn't work with your feature, I would suggest using Console function to examine the schema and its available fields.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;console(Schema(fs).fields)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 20:05:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/experience-builder-arcade-code-error-quot-cannot/m-p/1695930#M68403</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2026-04-13T20:05:59Z</dc:date>
    </item>
  </channel>
</rss>

