<?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: Error 002717 Invalid Arcade Expression, Arcade Error:Expected feature or feature set, Script Line 2 in ArcGIS Arcade Questions</title>
    <link>https://community.esri.com/t5/arcgis-arcade-questions/error-002717-invalid-arcade-expression-arcade/m-p/1696978#M151</link>
    <description>&lt;P&gt;I'd put some guard clauses in your script since line 2 has the possibility of failure since you may not have any intersecting areas:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if ($feature.CH_AREA_FK != NULL){ return $feature.CH_AREA_FK }

var CHAreas = Intersects(FeatureSetByName($datastore, 'CharacterArea', ["MSLINK"], false), $feature)

// NOTE: You should use Count(CHAreas) == 0 here if using 
// an older version of Arcade. Container checking was added 
// pretty recently
if (isEmpty(CHAreas, true)) { return $feature.CH_AREA_FK }

var OverlapCHAreas= Upper(DomainName(First(CHAreas, 'MSLINK')))

return OverlapCHAreas&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Move the Intersect operation to the FeatureSetByName function since that allows you to skip actually loading the geometries, It also lets you then test if anything is intersecting before pulling out the first intersecting area and formatting the MSLINK field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#isempty" target="_blank" rel="noopener"&gt;Link to the isEmpty docs to explain that note&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Apr 2026 15:41:06 GMT</pubDate>
    <dc:creator>HaydenWelch</dc:creator>
    <dc:date>2026-04-17T15:41:06Z</dc:date>
    <item>
      <title>Error 002717 Invalid Arcade Expression, Arcade Error:Expected feature or feature set, Script Line 2</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/error-002717-invalid-arcade-expression-arcade/m-p/1696953#M150</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a fairly simple arcade script that has been working for the past 6 years, but is now returning error, 002717.&lt;/P&gt;&lt;P&gt;From what I understand, this is a bug? Is there a work around for it? I pasted the code for anyone to look at.&amp;nbsp;&lt;BR /&gt;Basically the script will update the CH_AREA_FK with an MSLINK value from the "Character Area" feature class when a point is placed on the map.&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Justin&lt;/P&gt;&lt;LI-CODE lang="php"&gt;var CHAreas = FeatureSetByName($datastore, 'CharacterArea', ["MSLINK"], true);
var OverlapCHAreas= Upper(DomainName(First(Intersects(CHAreas, Geometry($feature))), 'MSLINK'));
if (isEmpty($feature.CH_AREA_FK)){
return OverlapCHAreas;
}
return $feature.CH_AREA_FK&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2026 15:09:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/error-002717-invalid-arcade-expression-arcade/m-p/1696953#M150</guid>
      <dc:creator>JustinBernard1886</dc:creator>
      <dc:date>2026-04-17T15:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Error 002717 Invalid Arcade Expression, Arcade Error:Expected feature or feature set, Script Line 2</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/error-002717-invalid-arcade-expression-arcade/m-p/1696978#M151</link>
      <description>&lt;P&gt;I'd put some guard clauses in your script since line 2 has the possibility of failure since you may not have any intersecting areas:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if ($feature.CH_AREA_FK != NULL){ return $feature.CH_AREA_FK }

var CHAreas = Intersects(FeatureSetByName($datastore, 'CharacterArea', ["MSLINK"], false), $feature)

// NOTE: You should use Count(CHAreas) == 0 here if using 
// an older version of Arcade. Container checking was added 
// pretty recently
if (isEmpty(CHAreas, true)) { return $feature.CH_AREA_FK }

var OverlapCHAreas= Upper(DomainName(First(CHAreas, 'MSLINK')))

return OverlapCHAreas&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Move the Intersect operation to the FeatureSetByName function since that allows you to skip actually loading the geometries, It also lets you then test if anything is intersecting before pulling out the first intersecting area and formatting the MSLINK field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#isempty" target="_blank" rel="noopener"&gt;Link to the isEmpty docs to explain that note&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2026 15:41:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/error-002717-invalid-arcade-expression-arcade/m-p/1696978#M151</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2026-04-17T15:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Error 002717 Invalid Arcade Expression, Arcade Error:Expected feature or feature set, Script Line 2</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/error-002717-invalid-arcade-expression-arcade/m-p/1697195#M153</link>
      <description>&lt;P&gt;Great! Thanks for the help. Code worked.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2026 12:37:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/error-002717-invalid-arcade-expression-arcade/m-p/1697195#M153</guid>
      <dc:creator>JustinBernard1886</dc:creator>
      <dc:date>2026-04-20T12:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Error 002717 Invalid Arcade Expression, Arcade Error:Expected feature or feature set, Script Line 2</title>
      <link>https://community.esri.com/t5/arcgis-arcade-questions/error-002717-invalid-arcade-expression-arcade/m-p/1697531#M154</link>
      <description>&lt;P&gt;The other thing to consider is using the&amp;nbsp;&lt;STRONG&gt;IIF&amp;nbsp;&lt;/STRONG&gt;function to determine if the record is a feature vs an empty value. Typically something like:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var CHAreas = FeatureSetByName($datastore, 'CharacterArea', ["MSLINK"], true)
var F = First(Intesects(CHAreas,Geometry($feature)))
iif( TypeOf(F) == 'Feature', Upper(DomainName(F,'MS_Link)), $feature.CH_AREA_FK )&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Apr 2026 20:54:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-arcade-questions/error-002717-invalid-arcade-expression-arcade/m-p/1697531#M154</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2026-04-21T20:54:05Z</dc:date>
    </item>
  </channel>
</rss>

