<?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 Arcade with Related Records Problem in Enterprise Webmap in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/arcade-with-related-records-problem-in-enterprise/m-p/80343#M475</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having an issue with Arcade fetching related records when using a FeatureServer layer in the WebMap. The code:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var tbl = FeatureSetByName($datastore,"Raptor_Protection_Repeat");&lt;/P&gt;&lt;P&gt;var code = $feature.GUID;&lt;/P&gt;&lt;P&gt;var sql = "GUID = '" + code + "'";&lt;BR /&gt;Console(code);&lt;BR /&gt;Console(sql);&lt;/P&gt;&lt;P&gt;var related_data = Filter(tbl, sql);&lt;/P&gt;&lt;P&gt;var cnt = Count(related_data);&lt;BR /&gt;Console(cnt);&lt;BR /&gt;var result = cnt + " related records";&lt;/P&gt;&lt;P&gt;if (cnt &amp;gt; 0) {&lt;BR /&gt; // loop through related records&lt;BR /&gt; for (var row in related_data) {&lt;BR /&gt; // read some data and create the line you want&lt;BR /&gt; var line = TextFormatting.NewLine + " - " + row.PROTECTION;&lt;BR /&gt; // add the line to the result&lt;BR /&gt; result += line;&lt;BR /&gt; }&lt;BR /&gt;} else {&lt;BR /&gt; result = "No related records:";&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// return the result&lt;BR /&gt;return result;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This works as expected if the layer in the Map is&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://gis.uns.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/MapServer/0" title="https://gis.uns.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/MapServer/0"&gt;https://myserver.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/MapServer/0&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But for this application, I need&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://gis.uns.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/FeatureServer/0" title="https://gis.uns.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/FeatureServer/0"&gt;https://myserver.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/FeatureServer/0&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try the above code as an arcade expression on the FeatureServer layer, I get the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #de2900; background-color: rgba(255, 255, 255, 0.8);"&gt;Execution Error:&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;Feature Not Found&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;The console produces the count and sql as expected. It seems to fail on loop, specifically "var row in related_data".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;In Dev tools (chrome) I see the following error:&amp;nbsp;/portal/jsapi/jsapi4/:346 [esri.tasks.support.optimizedFeatureSet] convertToFeatureSet:unknown-geometry [object Object]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;Any insight here would be greatly appreciated!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;Jim Faron&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Mar 2020 18:03:06 GMT</pubDate>
    <dc:creator>JamesFaron</dc:creator>
    <dc:date>2020-03-09T18:03:06Z</dc:date>
    <item>
      <title>Arcade with Related Records Problem in Enterprise Webmap</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-with-related-records-problem-in-enterprise/m-p/80343#M475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having an issue with Arcade fetching related records when using a FeatureServer layer in the WebMap. The code:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var tbl = FeatureSetByName($datastore,"Raptor_Protection_Repeat");&lt;/P&gt;&lt;P&gt;var code = $feature.GUID;&lt;/P&gt;&lt;P&gt;var sql = "GUID = '" + code + "'";&lt;BR /&gt;Console(code);&lt;BR /&gt;Console(sql);&lt;/P&gt;&lt;P&gt;var related_data = Filter(tbl, sql);&lt;/P&gt;&lt;P&gt;var cnt = Count(related_data);&lt;BR /&gt;Console(cnt);&lt;BR /&gt;var result = cnt + " related records";&lt;/P&gt;&lt;P&gt;if (cnt &amp;gt; 0) {&lt;BR /&gt; // loop through related records&lt;BR /&gt; for (var row in related_data) {&lt;BR /&gt; // read some data and create the line you want&lt;BR /&gt; var line = TextFormatting.NewLine + " - " + row.PROTECTION;&lt;BR /&gt; // add the line to the result&lt;BR /&gt; result += line;&lt;BR /&gt; }&lt;BR /&gt;} else {&lt;BR /&gt; result = "No related records:";&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// return the result&lt;BR /&gt;return result;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This works as expected if the layer in the Map is&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://gis.uns.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/MapServer/0" title="https://gis.uns.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/MapServer/0"&gt;https://myserver.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/MapServer/0&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But for this application, I need&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://gis.uns.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/FeatureServer/0" title="https://gis.uns.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/FeatureServer/0"&gt;https://myserver.com/arcgis/rest/services/Raptor_Protection/Raptor_Protection/FeatureServer/0&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try the above code as an arcade expression on the FeatureServer layer, I get the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #de2900; background-color: rgba(255, 255, 255, 0.8);"&gt;Execution Error:&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;Feature Not Found&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;The console produces the count and sql as expected. It seems to fail on loop, specifically "var row in related_data".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;In Dev tools (chrome) I see the following error:&amp;nbsp;/portal/jsapi/jsapi4/:346 [esri.tasks.support.optimizedFeatureSet] convertToFeatureSet:unknown-geometry [object Object]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;Any insight here would be greatly appreciated!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: rgba(255, 255, 255, 0.8);"&gt;Jim Faron&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2020 18:03:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-with-related-records-problem-in-enterprise/m-p/80343#M475</guid>
      <dc:creator>JamesFaron</dc:creator>
      <dc:date>2020-03-09T18:03:06Z</dc:date>
    </item>
  </channel>
</rss>

