<?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 general evaluation error creating an attribute rule in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-general-evaluation-error-creating-an/m-p/1034228#M38276</link>
    <description>&lt;P&gt;I'm trying to apply an attribute rule to an enterprise geodatabase feature class.&lt;/P&gt;&lt;P&gt;I have a tree feature class that has both species (scientific) and common name attribute. I'm trying to automatically fill in the common name based on what species an editor enters. I have a lookup table,&amp;nbsp;ENV_TREESPECIES_LUT, that lists the species name and common name.&lt;/P&gt;&lt;P&gt;The general workflow I'm trying to achive is:&lt;/P&gt;&lt;P&gt;If a new tree feature has a species value then search the ENV_TREESPECIES_LUT for that species and return the common name&lt;/P&gt;&lt;P&gt;But no no matter what logic I've tried the attribute rule editor in Pro gives me an evaluation error on line 5 of this script below. It seems to the filter function. What is the correct way to filter on an feature attribute?&lt;/P&gt;&lt;P&gt;I should mention that the code validates in the expression builder, the error is only thrown when I try to save the attribute rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var cn = ""
var fspecies =  $feature.Species
if(! isEmpty($feature.Species)) 
    var LUT = FeatureSetByName( $datastore, "ENV_TREESPECIES_LUT", ["Species", "CommonName"], false)
    var common_names = Filter(LUT, "Species = @fspecies")
    var common_name = first(common_names)
    if (! IsEmpty(common_name.CommonName))
        cn = common_name.CommonName
return cn&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Mar 2021 22:42:37 GMT</pubDate>
    <dc:creator>DrewDowling</dc:creator>
    <dc:date>2021-03-08T22:42:37Z</dc:date>
    <item>
      <title>Arcade general evaluation error creating an attribute rule</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-general-evaluation-error-creating-an/m-p/1034228#M38276</link>
      <description>&lt;P&gt;I'm trying to apply an attribute rule to an enterprise geodatabase feature class.&lt;/P&gt;&lt;P&gt;I have a tree feature class that has both species (scientific) and common name attribute. I'm trying to automatically fill in the common name based on what species an editor enters. I have a lookup table,&amp;nbsp;ENV_TREESPECIES_LUT, that lists the species name and common name.&lt;/P&gt;&lt;P&gt;The general workflow I'm trying to achive is:&lt;/P&gt;&lt;P&gt;If a new tree feature has a species value then search the ENV_TREESPECIES_LUT for that species and return the common name&lt;/P&gt;&lt;P&gt;But no no matter what logic I've tried the attribute rule editor in Pro gives me an evaluation error on line 5 of this script below. It seems to the filter function. What is the correct way to filter on an feature attribute?&lt;/P&gt;&lt;P&gt;I should mention that the code validates in the expression builder, the error is only thrown when I try to save the attribute rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var cn = ""
var fspecies =  $feature.Species
if(! isEmpty($feature.Species)) 
    var LUT = FeatureSetByName( $datastore, "ENV_TREESPECIES_LUT", ["Species", "CommonName"], false)
    var common_names = Filter(LUT, "Species = @fspecies")
    var common_name = first(common_names)
    if (! IsEmpty(common_name.CommonName))
        cn = common_name.CommonName
return cn&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 22:42:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-general-evaluation-error-creating-an/m-p/1034228#M38276</guid>
      <dc:creator>DrewDowling</dc:creator>
      <dc:date>2021-03-08T22:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade general evaluation error creating an attribute rule</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-general-evaluation-error-creating-an/m-p/1034238#M38277</link>
      <description>&lt;P&gt;Your &lt;STRONG&gt;if&lt;/STRONG&gt; statements need curly braces, not just indents. I think that's all you'd need to adjust there.&lt;/P&gt;&lt;PRE&gt;if(condition){&lt;BR /&gt;    // do something&lt;BR /&gt;    if(another_condition){&lt;BR /&gt;        // do another thing&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 22:57:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-general-evaluation-error-creating-an/m-p/1034238#M38277</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-03-08T22:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade general evaluation error creating an attribute rule</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-general-evaluation-error-creating-an/m-p/1034242#M38279</link>
      <description>&lt;P&gt;It works perfectly now.&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 23:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-general-evaluation-error-creating-an/m-p/1034242#M38279</guid>
      <dc:creator>DrewDowling</dc:creator>
      <dc:date>2021-03-08T23:31:08Z</dc:date>
    </item>
  </channel>
</rss>

