<?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: Attribute Rules Arcade expression in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-arcade-expression/m-p/1419629#M82855</link>
    <description>&lt;P&gt;You are on the right track using the Filter function.&amp;nbsp; In your code, the Count is just returning the number of characters in the Region field for the $feature, which will always be 1 since its either A or B.&amp;nbsp; You need to pass a FeatureSet into the Count to get a record count. For the Filter function, I am passing $layer, which is the layer the $feature belongs to.&amp;nbsp; Then I am filtering the features that have the same Region as the $feature and getting the count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return Count(Filter($layer, "Region = '"+$feature.Region+"'"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 May 2024 20:02:34 GMT</pubDate>
    <dc:creator>Justin_Greco</dc:creator>
    <dc:date>2024-05-06T20:02:34Z</dc:date>
    <item>
      <title>Attribute Rules Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-arcade-expression/m-p/1419608#M82852</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I'm trying to write an expression to count the number of values, for each type within a field (i.e. region A, region B) to populate a second field with the results, with Attribute Rules. So far I can select the region for each entry but I have not been able to filter the count for each entry by its region. My code so far:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;When ($feature.Region=='A',Count($feature.Region), $feature.Region=='B',Count($feature.Region),1000)&lt;/LI-CODE&gt;&lt;P&gt;I tried using the filter but I could not get it to work.&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;BR /&gt;Thanks&lt;/P&gt;&lt;P&gt;Randy&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 19:20:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-arcade-expression/m-p/1419608#M82852</guid>
      <dc:creator>RandyMcGraw1</dc:creator>
      <dc:date>2024-05-06T19:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rules Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-arcade-expression/m-p/1419629#M82855</link>
      <description>&lt;P&gt;You are on the right track using the Filter function.&amp;nbsp; In your code, the Count is just returning the number of characters in the Region field for the $feature, which will always be 1 since its either A or B.&amp;nbsp; You need to pass a FeatureSet into the Count to get a record count. For the Filter function, I am passing $layer, which is the layer the $feature belongs to.&amp;nbsp; Then I am filtering the features that have the same Region as the $feature and getting the count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return Count(Filter($layer, "Region = '"+$feature.Region+"'"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 20:02:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-arcade-expression/m-p/1419629#M82855</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2024-05-06T20:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rules Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-arcade-expression/m-p/1420384#M82971</link>
      <description>&lt;P&gt;Thanks Justin_Greco, I believe your expressions is correct but since I am using ArcGIS pro 2.7.1 it does not recognize&amp;nbsp;&lt;EM&gt;$layer.&amp;nbsp;&lt;/EM&gt;I am looking with my IT department to see if I can update my pro version to 3.2 which would allow me to use your expression.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 13:34:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-arcade-expression/m-p/1420384#M82971</guid>
      <dc:creator>RandyMcGraw1</dc:creator>
      <dc:date>2024-05-08T13:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rules Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-arcade-expression/m-p/1420391#M82973</link>
      <description>&lt;P&gt;$layer might not be available for attribute rule profile, so I think you can use FeatureSetByName, I'm not sure what your layer name is, so replace "Regions" with your layer's name.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByName($datastore, "Regions")
return Count(Filter(fs, "Region = '"+$feature.Region+"'"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 13:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rules-arcade-expression/m-p/1420391#M82973</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2024-05-08T13:43:44Z</dc:date>
    </item>
  </channel>
</rss>

