<?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 error when accessing empty feature set in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196396#M1193</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm just starting to use Arcade - like it a lot so far but there is one scenario that I can't figure out. I want to retrieve the set of related records associated with a feature for my ArcGIS Online web map popup. I can do this with this statement&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByRelationshipName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Program"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"ProgramName"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;false&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works great except when the feature has no related records. I still get a FeatureSet returned, and I would expect it to contain zero features. But any method I use to access the FeatureSet returns "&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;Cannot read property 'toString' of null&lt;/SPAN&gt;". I've tried all of the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Count(fs)&lt;/LI&gt;&lt;LI&gt;for (var f in fs) {}&lt;/LI&gt;&lt;LI&gt;First(fs)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;What is the trick to allow me to detect in my code that the feature set is empty?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Apr 2020 15:51:01 GMT</pubDate>
    <dc:creator>DonMorrison1</dc:creator>
    <dc:date>2020-04-26T15:51:01Z</dc:date>
    <item>
      <title>Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196396#M1193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm just starting to use Arcade - like it a lot so far but there is one scenario that I can't figure out. I want to retrieve the set of related records associated with a feature for my ArcGIS Online web map popup. I can do this with this statement&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByRelationshipName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Program"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"ProgramName"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;false&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works great except when the feature has no related records. I still get a FeatureSet returned, and I would expect it to contain zero features. But any method I use to access the FeatureSet returns "&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;Cannot read property 'toString' of null&lt;/SPAN&gt;". I've tried all of the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Count(fs)&lt;/LI&gt;&lt;LI&gt;for (var f in fs) {}&lt;/LI&gt;&lt;LI&gt;First(fs)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;What is the trick to allow me to detect in my code that the feature set is empty?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2020 15:51:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196396#M1193</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2020-04-26T15:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196397#M1194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/don.morrison" target="_blank"&gt;don.morrison&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are right to asume that a FeatureSet is returned which will have 0 features if there are no records in the related table. It is strange that&amp;nbsp;you get this unexpected behavior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just did a test and it works for me:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fsrel &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByRelationshipName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"RelData"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fsrel&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fsrel&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;TypeOf&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fsrel&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case of not having a related record in the table it returns as expected:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;object, FeatureSet
0
FeatureSet&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you use the GUI to define the FeatureSetByRelationshipName row in your expression? It is either caused by that or perhaps caused by your data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you would be able to share the data or web map with me I could take a closer look.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:48:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196397#M1194</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T09:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196398#M1195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander. Yes - I used the GUI to create the Arcade expression.&amp;nbsp;&amp;nbsp;I have 3 feature classes that have a relationship with the "Program" table and they all seem to have the same problem.&amp;nbsp; If you want to take a look first hand I can send you credentials to our test organization - let me know where to send that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought maybe it had something to do with my data being served up from an ArcGIS server REST endpoint - but you can see here that it works for one relationship but not the other.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fs1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByRelationshipName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Site_ConservationMeasures"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fs2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByRelationshipName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Program"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fs1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fs2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Use Console Function to output messages. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Execution Error:Cannot read property 'toString' of null‍‍‍&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is what the relationship looks like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/490427_pastedImage_2.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:48:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196398#M1195</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2021-12-11T09:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196399#M1196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/don.morrison"&gt;don.morrison&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can have multiple relationships to a table called "Program", but each relationship&lt;STRONG&gt;name&lt;/STRONG&gt; will be different. I think that is what is causing the error that you see. Otherwise you should get a featureset (which could have 0 features).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2020 21:38:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196399#M1196</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-04-29T21:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196400#M1197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean that the "Relationship Class" names must be different? In any case, they are unique, but some of the path labels are not.&amp;nbsp;&lt;SPAN&gt;ROW_Habitat.SDE.Program is the table that seems to be the one that causes the problem - it participates in 4 relationships.&amp;nbsp; It is the origin in all&amp;nbsp;of them.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef;"&gt;&lt;TH style="width: 31.0655%;"&gt;Relationship Class name&lt;/TH&gt;&lt;TH style="width: 29.9101%;"&gt;Backward path label&lt;/TH&gt;&lt;TH style="width: 16.6881%;"&gt;Forward path label&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="width: 31.0655%;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;ROW_Habitat.SDE.Program_to_MgtAreas&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 29.9101%;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Program&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 16.6881%;"&gt;&lt;SPAN style="font-size: 12px;"&gt;ManagementArea&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="width: 31.0655%;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;ROW_Habitat.SDE.Program_to_MgtMeasures&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 29.9101%;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Program&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 16.6881%;"&gt;&lt;SPAN style="font-size: 12px;"&gt;MgmtArea_ConservationMeasures&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="width: 31.0655%;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;ROW_Habitat.SDE.Program_to_Sites&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="width: 29.9101%;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Program&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 16.6881%;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Site&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="width: 31.0655%;"&gt;&lt;SPAN style="font-size: 12px;"&gt;ROW_Habitat.SDE.Program_to_PollinatorScorecards&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 29.9101%;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Program&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 16.6881%;"&gt;&lt;SPAN style="font-size: 12px;"&gt;PollinatorScorecard&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2020 22:17:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196400#M1197</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2020-04-29T22:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196401#M1198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/359537"&gt;Don Morrison&lt;/A&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you&amp;nbsp;want to&amp;nbsp;access data using a relationship name, the best way to do this in AGOL is to go through the interface to make sure you use the correct name for the relationship in Arcade.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in the Arcade expression GUI, expand the $feature (click on "&amp;gt;" right from $feature):&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/490429_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;Next at the bottom you will find something called "Related records" (or similar, sorry for my Spanish screenshot).&amp;nbsp;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;click on "&amp;gt;" right from "Related records"):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/490445_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you will see the relationships listed. Click on the link "FeatureSetByRelationshipName(...)" to get the correct&amp;nbsp;line in the Arcade expression editor window.&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/490446_pastedImage_4.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2020 23:51:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196401#M1198</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-04-29T23:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196402#M1199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander - that is exactly how I did it.&amp;nbsp; And the expression does work for those features where there exists one or more related records. The only problem is when there are no related records. I'd like to use the Count function to determine whether any records exist in the returned FeatureSet, but the function throws an error (is there a way to catch the error?) when it should return a count of 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2020 01:40:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196402#M1199</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2020-04-30T01:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196403#M1200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK - I finally figured out what I need to do to get this to work.&amp;nbsp; Since the feature class that I'm in is the destination of the 1 to many relationship, there can only be either zero or one related records.&amp;nbsp; So I check the foreign key field for null before calling the&amp;nbsp;FeatureSetByRelationshipName function like this and that avoids the error that I was getting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ProgramGUID &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;First&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;FeatureSetByRelationshipName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Program"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for helping me work through this Xander!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:48:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196403#M1200</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2021-12-11T09:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196404#M1201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for sharing&amp;nbsp;&lt;A href="https://community.esri.com/people/don.morrison"&gt;don.morrison&lt;/A&gt;&amp;nbsp;, glad you could resolve it!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2020 19:55:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/196404#M1201</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-05-08T19:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1149586#M6204</link>
      <description>&lt;P&gt;&lt;STRONG&gt;I wanted to thank you for posting this.&lt;/STRONG&gt;&amp;nbsp; I ran into a similar error that cropped up in FieldMaps.&amp;nbsp;&lt;/P&gt;&lt;P&gt;~My custom scripts were working &lt;STRIKE&gt;fine&lt;/STRIKE&gt; okay* in &lt;A title="GPT on AGOL" href="https://odwc.maps.arcgis.com/home/item.html?id=4e7e443f020d47a0b55385a0eec7c901" target="_blank" rel="noopener"&gt;AGOL&lt;/A&gt; and the &lt;A title="GPT ExB App" href="https://odwc.maps.arcgis.com/home/item.html?id=fc2c2659a3ab4427a6aeb244b2e7adf3" target="_blank" rel="noopener"&gt;ExB App&lt;/A&gt;, but when viewed from the FieldMaps App would throw 'unknown data type' errors.&lt;/P&gt;&lt;P&gt;My initial statement wound up being:&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Capture.PNG" style="width: 603px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/35350i5A6BF0ADF35C0E68/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="100%"&gt;&lt;FONT color="#3366FF"&gt;Features that would have a related record &lt;EM&gt;also had&lt;/EM&gt; a CATEGORY field value containing the text 'Start'&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I really ought to revamp the whole thing, I've realized.&amp;nbsp;&lt;FONT color="#FFFFFF"&gt; I don't think a foreign GUID was used.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;*At some point, the AGOL map was producing &lt;STRONG&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;"Execution &lt;/SPAN&gt;&lt;SPAN class=""&gt;Error:d&lt;/SPAN&gt;&lt;SPAN class=""&gt; is null"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt; errors for the same scripts, but it stopped for no reason I can determine.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 15:06:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1149586#M6204</guid>
      <dc:creator>DavidMurray_ODWC</dc:creator>
      <dc:date>2022-03-02T15:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155275#M6220</link>
      <description>&lt;P&gt;Hello Everybody,&lt;/P&gt;&lt;P&gt;I have the same problem than&amp;nbsp;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/192850" target="_self"&gt;&lt;SPAN class=""&gt;DonMorrison1&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;but I can't solved it. I got the same error msg.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KARIMLABIDI_1-1647618557004.png" style="width: 627px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36734i53EAC6BA89EC5B3C/image-dimensions/627x393?v=v2" width="627" height="393" role="button" title="KARIMLABIDI_1-1647618557004.png" alt="KARIMLABIDI_1-1647618557004.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KARIMLABIDI_2-1647618594559.png" style="width: 584px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36735i3B1C94BBC629C833/image-dimensions/584x206?v=v2" width="584" height="206" role="button" title="KARIMLABIDI_2-1647618594559.png" alt="KARIMLABIDI_2-1647618594559.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried the little code of Dan but it doesn't work .&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 15:51:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155275#M6220</guid>
      <dc:creator>KARIMLABIDI</dc:creator>
      <dc:date>2022-03-18T15:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155576#M6221</link>
      <description>&lt;P&gt;Your "build out popup" code is wrong.&lt;/P&gt;&lt;P&gt;If you only want to return the first entry of relateData:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var firstRelateData = First(relateData)
if(firstRelateData == null) {  // no related data
  return "null"
}
return firstRelateData.num_arret&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to return all related features:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if(Count(relateData) == 0) {  // no related data
  return "null"
}
var all_num_arrets  = []
for(var f in relateData) {
  if(f.num_arret != null) {
    Push(all_num_arrets, f.num_arret)
  }
}
return Concatenate(all_num_arrets, ", ")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Mar 2022 06:03:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155576#M6221</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-03-21T06:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155602#M6222</link>
      <description>&lt;P&gt;Thank you Johannes but I Got the same problem. I can't count the relateData with the filter, the problem is in.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't understand this error msg because I have data in each row of my table.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KARIMLABIDI_0-1647850546749.png" style="width: 479px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36810i1BE32CBFA8FE9ED8/image-dimensions/479x296?v=v2" width="479" height="296" role="button" title="KARIMLABIDI_0-1647850546749.png" alt="KARIMLABIDI_0-1647850546749.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KARIMLABIDI_1-1647850712363.png" style="width: 616px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36811iE4E0CC8015923523/image-dimensions/616x267?v=v2" width="616" height="267" role="button" title="KARIMLABIDI_1-1647850712363.png" alt="KARIMLABIDI_1-1647850712363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 08:19:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155602#M6222</guid>
      <dc:creator>KARIMLABIDI</dc:creator>
      <dc:date>2022-03-21T08:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155616#M6223</link>
      <description>&lt;P&gt;Hmmm. Try adding this at the start of your script:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if(IsEmpty($feature.IDARRET)) {
  return "null"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 09:32:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155616#M6223</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-03-21T09:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155636#M6224</link>
      <description>&lt;P&gt;yes it works. Thank you!!&lt;/P&gt;&lt;P&gt;Juste one more question about it: do U know how can i put a little symbol just before my attributes. When i do like this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;for(var f in relateData) {
  if(f.num_arret != null) {
    Push(all_num_arrets, 
    ` "https://xxxxxxxx/rest/content/items/9e3929af55db440ea45c5f72e37cd3c5/data" ${f.hor_theo_1mn} `)
    Push(all_num_arrets, 
    ` "https://xxxxxxxx/rest/content/items/9e3929af55db440ea45c5f72e37cd3c5/data"${f.hor_theo_2mns} `)
  }
}&lt;/LI-CODE&gt;&lt;P&gt;, it just gives me the URL and not the image.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 10:41:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155636#M6224</guid>
      <dc:creator>KARIMLABIDI</dc:creator>
      <dc:date>2022-03-21T10:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155649#M6225</link>
      <description>&lt;P&gt;Arcade doesn't evaluate HTML. Maybe what you want to do is possible, but it will be a little complicated.&lt;/P&gt;&lt;P&gt;I suggest posting a new question for this, as this goes far beyond the scope of the original question, and you'll get more views and potential answers.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 11:02:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1155649#M6225</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-03-21T11:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade error when accessing empty feature set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1321754#M6720</link>
      <description>&lt;P&gt;Hello, I'm getting an issue trying to run this procedure but I can't quite figure out what's wrong. Here's my code:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var assets = FeatureSetByRelationshipName($feature, 'epgdb.PARKS.Asset_Inventory', ['*'], true)
console(assets)
console(count(assets))
console(typeof(assets))
// Get the first park asset (should only be one)
var asset = First(assets)
Expects(assets, 'AssetType')
// If there was an asset, return the AssetType of it,
// Otherwise, return null
if (!IsEmpty(asset)) {
    return asset['AssetType']
} else {
    return null
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I have park assets, with a related inspection table. The table is where I'm placing this code, and the relationship name in the featureSetByRelationshipName function is the backward path label from my EGDB relationship class (is that correct?)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ZachBodenner_0-1692809664418.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78948iB169ACD36CDB76FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ZachBodenner_0-1692809664418.png" alt="ZachBodenner_0-1692809664418.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've tried adjusting a lot of the parameters but the closest I get is always returning null:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ZachBodenner_1-1692809719293.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78949iC61D50127AA3284F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ZachBodenner_1-1692809719293.png" alt="ZachBodenner_1-1692809719293.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The console messages indicate 0 assets, which I guess makes sense considering this is just in the expression builder and probably doesn't know what the related table would be targetting?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ZachBodenner_2-1692809788307.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78950i1715DDDD6009F2C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ZachBodenner_2-1692809788307.png" alt="ZachBodenner_2-1692809788307.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that when I open Field Maps and try to create a related record, the field I add the calculation to just gives me the error: "Failed to calculate"&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2023 16:59:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-error-when-accessing-empty-feature-set/m-p/1321754#M6720</guid>
      <dc:creator>ZachBodenner</dc:creator>
      <dc:date>2023-08-23T16:59:08Z</dc:date>
    </item>
  </channel>
</rss>

