<?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: Help with arcade expression in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression/m-p/1207731#M59250</link>
    <description>&lt;P&gt;You're telling your DBMS to use the literal SQL query "ID = $feature.ID". This isn't a valid where clause and so it fails.&lt;/P&gt;&lt;P&gt;What you want to do is store the $feature.ID in a variable and use the&amp;nbsp;@ notation of &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#filter" target="_blank" rel="noopener"&gt;Filter()&lt;/A&gt; to take care of the type formatting for you.&lt;/P&gt;&lt;P&gt;Also, you aren't looping over the filtered feature set, but over the whole table...&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var Land = FeatureSetByName($datastore, "Land", [ "Location", "Name", "County", "School_District", "ID"]);

var id = $feature.ID
var related = Filter(Land,"ID=@id")
var location = First(related)

if(location == null) {
    // no related features found -&amp;gt; return a default value
    return null
}
// else return the related feature's ID
return location.ID&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Aug 2022 15:26:11 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-08-30T15:26:11Z</dc:date>
    <item>
      <title>Help with arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression/m-p/1207686#M59241</link>
      <description>&lt;P&gt;I am trying to pull from a feature set the location by filtering it by the relationship ID. I have similar formulas that work fine, but for some reason I am having trouble with this one. I have the following, could someone please help? The below rule is working, but pulling the first row from attribute table. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var Land = FeatureSetByName($datastore, "Land", [ "Location","Name","County","School_District","ID"]);&lt;/P&gt;&lt;P&gt;VAR LOCATION = FILTER(LAND,"ID=$feature.ID")&lt;/P&gt;&lt;P&gt;FOR(VAR I IN LAND)&lt;BR /&gt;RETURN I.LOCATION&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 14:22:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression/m-p/1207686#M59241</guid>
      <dc:creator>Robswann</dc:creator>
      <dc:date>2022-08-30T14:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help with arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression/m-p/1207725#M59248</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Do you mean to loop through the original dataset or the filtered dataset? Also, I'm not sure if the curly braces are required in Arcade.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/guide/logic/#for-loops" target="_blank"&gt;https://developers.arcgis.com/arcade/guide/logic/#for-loops&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Does the following work?&lt;/P&gt;&lt;P&gt;var Land = FeatureSetByName($datastore, "Land", [ "Location","Name","County","School_District","ID"]);&lt;/P&gt;&lt;P&gt;VAR LOCATION = FILTER(LAND,"ID=$feature.ID")&lt;/P&gt;&lt;P&gt;FOR(VAR I IN LOCATION ) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RETURN I.LOCATION&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 15:21:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression/m-p/1207725#M59248</guid>
      <dc:creator>JillianStanford</dc:creator>
      <dc:date>2022-08-30T15:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help with arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression/m-p/1207731#M59250</link>
      <description>&lt;P&gt;You're telling your DBMS to use the literal SQL query "ID = $feature.ID". This isn't a valid where clause and so it fails.&lt;/P&gt;&lt;P&gt;What you want to do is store the $feature.ID in a variable and use the&amp;nbsp;@ notation of &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#filter" target="_blank" rel="noopener"&gt;Filter()&lt;/A&gt; to take care of the type formatting for you.&lt;/P&gt;&lt;P&gt;Also, you aren't looping over the filtered feature set, but over the whole table...&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var Land = FeatureSetByName($datastore, "Land", [ "Location", "Name", "County", "School_District", "ID"]);

var id = $feature.ID
var related = Filter(Land,"ID=@id")
var location = First(related)

if(location == null) {
    // no related features found -&amp;gt; return a default value
    return null
}
// else return the related feature's ID
return location.ID&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 15:26:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression/m-p/1207731#M59250</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-08-30T15:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help with arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression/m-p/1207735#M59252</link>
      <description>&lt;P&gt;Very Helpful. Thank so much!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 15:30:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-arcade-expression/m-p/1207735#M59252</guid>
      <dc:creator>Robswann</dc:creator>
      <dc:date>2022-08-30T15:30:50Z</dc:date>
    </item>
  </channel>
</rss>

