<?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 How to use Arcade to filter a list of related features based on an attribute in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593107#M93751</link>
    <description>&lt;P&gt;I hope this is the right place to post this.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;From searching around it appears that you cannot dynamically display a count of related features on a label or map tip, but the workaround is to write the information to a field, and then use that within the necessary expressions.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I can successfully write the total number of related features to a field with the following code:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var relatedFeatures = FeatureSetByRelationshipName($feature, "&amp;lt;relationship_class_name&amp;gt;")
return Count(relatedFeatures)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That works great and returns a total of 5, which is how many features are related in the one feature that I am testing this on.&amp;nbsp; The image below shows the 5 related features.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cepotts_0-1741295410703.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/127309i638667045778891E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cepotts_0-1741295410703.png" alt="cepotts_0-1741295410703.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, the cable in that list is a sub-relation, and I don't want to include that feature in my count.&amp;nbsp; In this particular example, I want the final count to show as 4.&amp;nbsp; I was attempting to use the Filter() function to accomplish this, but I keep running into an invalid where clause error when adding the second line shown in the code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var relatedFeatures = FeatureSetByRelationshipName($feature, "&amp;lt;relationship_class_name&amp;gt;")
var filteredFeatures = Filter(relatedFeatures, "Data Type != 'cable'")
return Count(filteredFeatures)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attempted too many variations to recall.&amp;nbsp; Any tips to point me in the right direction?&amp;nbsp; I've been scouring through Google and ChatGPT and all of the examples returned lead me to exactly what I have written above.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Mar 2025 21:24:42 GMT</pubDate>
    <dc:creator>cepotts</dc:creator>
    <dc:date>2025-03-06T21:24:42Z</dc:date>
    <item>
      <title>How to use Arcade to filter a list of related features based on an attribute</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593107#M93751</link>
      <description>&lt;P&gt;I hope this is the right place to post this.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;From searching around it appears that you cannot dynamically display a count of related features on a label or map tip, but the workaround is to write the information to a field, and then use that within the necessary expressions.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I can successfully write the total number of related features to a field with the following code:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var relatedFeatures = FeatureSetByRelationshipName($feature, "&amp;lt;relationship_class_name&amp;gt;")
return Count(relatedFeatures)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That works great and returns a total of 5, which is how many features are related in the one feature that I am testing this on.&amp;nbsp; The image below shows the 5 related features.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cepotts_0-1741295410703.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/127309i638667045778891E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cepotts_0-1741295410703.png" alt="cepotts_0-1741295410703.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, the cable in that list is a sub-relation, and I don't want to include that feature in my count.&amp;nbsp; In this particular example, I want the final count to show as 4.&amp;nbsp; I was attempting to use the Filter() function to accomplish this, but I keep running into an invalid where clause error when adding the second line shown in the code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var relatedFeatures = FeatureSetByRelationshipName($feature, "&amp;lt;relationship_class_name&amp;gt;")
var filteredFeatures = Filter(relatedFeatures, "Data Type != 'cable'")
return Count(filteredFeatures)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attempted too many variations to recall.&amp;nbsp; Any tips to point me in the right direction?&amp;nbsp; I've been scouring through Google and ChatGPT and all of the examples returned lead me to exactly what I have written above.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 21:24:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593107#M93751</guid>
      <dc:creator>cepotts</dc:creator>
      <dc:date>2025-03-06T21:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter a list of related features based on an attribute</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593115#M93755</link>
      <description>&lt;P&gt;Here is the actual error message:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cepotts_0-1741296181202.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/127311i47CE0A2C23D01D8C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cepotts_0-1741296181202.png" alt="cepotts_0-1741296181202.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 21:23:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593115#M93755</guid>
      <dc:creator>cepotts</dc:creator>
      <dc:date>2025-03-06T21:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter a list of related features based on an attribute</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593313#M93767</link>
      <description>&lt;P&gt;You have to use "&amp;lt;&amp;gt;" instead of "!=" in SQL statements&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var filteredFeatures = Filter(relatedFeatures, "Data Type &amp;lt;&amp;gt; 'cable'")&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Mar 2025 14:16:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593313#M93767</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-03-07T14:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter a list of related features based on an attribute</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593315#M93768</link>
      <description>&lt;P&gt;Thank you for the response.&amp;nbsp; That is one of the variations that I tried.&amp;nbsp; It still returns the same message.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cepotts_0-1741357246764.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/127348i50158EE93F11D1B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cepotts_0-1741357246764.png" alt="cepotts_0-1741357246764.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 14:21:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593315#M93768</guid>
      <dc:creator>cepotts</dc:creator>
      <dc:date>2025-03-07T14:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter a list of related features based on an attribute</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593319#M93770</link>
      <description>&lt;P&gt;You also have a space in the field name, which is probably its alias. Use the actual field name.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 14:27:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593319#M93770</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-03-07T14:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcade to filter a list of related features based on an attribute</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593327#M93771</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; I did try that in other variations, but it was likely in completely different things that I was trying at the time.&amp;nbsp; I probably also still had the "!=" operator in there when attempting it.&amp;nbsp; Much appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 14:34:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-arcade-to-filter-a-list-of-related/m-p/1593327#M93771</guid>
      <dc:creator>cepotts</dc:creator>
      <dc:date>2025-03-07T14:34:55Z</dc:date>
    </item>
  </channel>
</rss>

