<?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: Filter a featureset by attribute in arcade when in attribute rule in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/filter-a-featureset-by-attribute-in-arcade-when-in/m-p/1264178#M66213</link>
    <description>&lt;P&gt;Thanks that worked!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2023 22:09:52 GMT</pubDate>
    <dc:creator>GarySpenst</dc:creator>
    <dc:date>2023-03-03T22:09:52Z</dc:date>
    <item>
      <title>Filter a featureset by attribute in arcade when in attribute rule</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/filter-a-featureset-by-attribute-in-arcade-when-in/m-p/1264158#M66208</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to make an attribute rule that calculates the length of Water Pipe within a polygon. I have had some success with&amp;nbsp; this arcade code:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var WatPipe=featuresetbyname($datastore,'WAT_Pipe',['*'])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Var Pipewithin=contains($feature,WatPipe)&lt;BR /&gt;return sum(length(Pipewithin))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;After getting this to work, I realized it was grabbing all the water pipes contained in the polygon which included the abandoned and removed water pipes.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Is there away to filter the feature set first? I tried this and didnt have any luck&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;var WatPipe=filter(featuresetbyname($datastore,'WAT_Pipes',['*']),'status= in service')&lt;BR /&gt;var Pipewithin=contains($feature,WatPipe)&lt;BR /&gt;return sum(length(Pipewithin))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Please help&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 20:48:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/filter-a-featureset-by-attribute-in-arcade-when-in/m-p/1264158#M66208</guid>
      <dc:creator>GarySpenst</dc:creator>
      <dc:date>2023-03-03T20:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a featureset by attribute in arcade when in attribute rule</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/filter-a-featureset-by-attribute-in-arcade-when-in/m-p/1264176#M66211</link>
      <description>&lt;P&gt;the filter statement in the Filter() function has to be a valid SQL statement.&lt;/P&gt;&lt;P&gt;You're using "status = in service", which is invalid, because status seems to be a text field, so the text value should be enclosed in single quotes.&lt;/P&gt;&lt;P&gt;You shouldn't need to call Sum(). &lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#length" target="_blank" rel="noopener"&gt;Length(featureset)&lt;/A&gt; already returns a single numeric value.&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var WatPipe = Filter(FeaturesetByName($datastore, 'WAT_Pipes', ['*']), "status = 'in service'")
var Pipewithin = Contains($feature, WatPipe)
return Length(Pipewithin)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 22:01:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/filter-a-featureset-by-attribute-in-arcade-when-in/m-p/1264176#M66211</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-03-03T22:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a featureset by attribute in arcade when in attribute rule</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/filter-a-featureset-by-attribute-in-arcade-when-in/m-p/1264178#M66213</link>
      <description>&lt;P&gt;Thanks that worked!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 22:09:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/filter-a-featureset-by-attribute-in-arcade-when-in/m-p/1264178#M66213</guid>
      <dc:creator>GarySpenst</dc:creator>
      <dc:date>2023-03-03T22:09:52Z</dc:date>
    </item>
  </channel>
</rss>

