<?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 Counting Features with a specific attribute not working in ArcGIS Utility Network Questions</title>
    <link>https://community.esri.com/t5/arcgis-utility-network-questions/counting-features-with-a-specific-attribute-not/m-p/1183483#M1826</link>
    <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;I try to count all adresses (in my Device Layer) with a specific attribute (MainProvider). For that, i tried the following code (as mentioned here: &lt;A title="UN Attribute Rules Expression Builder Arcade" href="https://community.esri.com/t5/arcgis-utility-network-questions/un-attribute-rules-expression-builder-arcade/m-p/1179426" target="_self"&gt;UN Attribute Rules Expression Builder Arcade&lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;// load all addresses
var addresses = FeatureSetByName($datastore, "AddressTableName", ["MainProvider"], false)

// filter the addresses for the main provider of the active feature
var provider = $feature.MainProvider
var filtered_addresses = Filter(addresses, "MainProvider = @provider")

// count and return error message
if(Count(filtered_addresses) &amp;gt; 25) {
    return {"errorMessage": "A provider can't supply more than 25 addresses!"}
}

// if we land here, the provider has &amp;lt;= 25 addresses
// rest of your code&lt;/PRE&gt;&lt;P&gt;When I use this code, the value of "filtered_adresses" is always identical with the amount of features in my device layer. So I guess the Filter is not working like this.&lt;/P&gt;&lt;P&gt;Do you know what I can do here? Or is there another way to get this done? Thanks in advance!&amp;nbsp;&lt;BR /&gt;Luca&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jun 2022 11:54:03 GMT</pubDate>
    <dc:creator>Luca_Schikowski</dc:creator>
    <dc:date>2022-06-16T11:54:03Z</dc:date>
    <item>
      <title>Counting Features with a specific attribute not working</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/counting-features-with-a-specific-attribute-not/m-p/1183483#M1826</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;I try to count all adresses (in my Device Layer) with a specific attribute (MainProvider). For that, i tried the following code (as mentioned here: &lt;A title="UN Attribute Rules Expression Builder Arcade" href="https://community.esri.com/t5/arcgis-utility-network-questions/un-attribute-rules-expression-builder-arcade/m-p/1179426" target="_self"&gt;UN Attribute Rules Expression Builder Arcade&lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;// load all addresses
var addresses = FeatureSetByName($datastore, "AddressTableName", ["MainProvider"], false)

// filter the addresses for the main provider of the active feature
var provider = $feature.MainProvider
var filtered_addresses = Filter(addresses, "MainProvider = @provider")

// count and return error message
if(Count(filtered_addresses) &amp;gt; 25) {
    return {"errorMessage": "A provider can't supply more than 25 addresses!"}
}

// if we land here, the provider has &amp;lt;= 25 addresses
// rest of your code&lt;/PRE&gt;&lt;P&gt;When I use this code, the value of "filtered_adresses" is always identical with the amount of features in my device layer. So I guess the Filter is not working like this.&lt;/P&gt;&lt;P&gt;Do you know what I can do here? Or is there another way to get this done? Thanks in advance!&amp;nbsp;&lt;BR /&gt;Luca&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 11:54:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/counting-features-with-a-specific-attribute-not/m-p/1183483#M1826</guid>
      <dc:creator>Luca_Schikowski</dc:creator>
      <dc:date>2022-06-16T11:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Features with a specific attribute not working</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/counting-features-with-a-specific-attribute-not/m-p/1206179#M1983</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/534269"&gt;@Luca_Schikowski&lt;/a&gt;&amp;nbsp; I don't see anything wrong with the code, as its written, but it is dependent on your schema and data. Things I'd be on the look out for:&lt;/P&gt;&lt;P&gt;If the main provided field populated in your source data?&lt;/P&gt;&lt;P&gt;Do they all have the same value?&lt;/P&gt;&lt;P&gt;Is the main provider field on the current feature null? The filter may fail if the current feature has a null provider.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 00:38:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/counting-features-with-a-specific-attribute-not/m-p/1206179#M1983</guid>
      <dc:creator>RobertKrisher</dc:creator>
      <dc:date>2022-08-25T00:38:01Z</dc:date>
    </item>
  </channel>
</rss>

