<?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: Need help with Attribute Rule for Intersecting feature in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619096#M96140</link>
    <description>&lt;P&gt;Thanks for the explanation of the return.&amp;nbsp; I tried your suggestion but I'm back to getting the error "Invalid expression" if I try to include a field name (DIAMETER) in the return statement:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SusanONeill1_0-1748464587643.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/133399i8CD211CB19AF3557/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SusanONeill1_0-1748464587643.png" alt="SusanONeill1_0-1748464587643.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 May 2025 20:37:52 GMT</pubDate>
    <dc:creator>SusanONeill1</dc:creator>
    <dc:date>2025-05-28T20:37:52Z</dc:date>
    <item>
      <title>Need help with Attribute Rule for Intersecting feature</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619041#M96130</link>
      <description>&lt;P&gt;I am trying to write an attribute rule that will compare the field "FITTING_SIZE"&amp;nbsp; in a Fitting (in this case a Water Tap) to the DIAMETER field in the Intersecting Water Service Line.&amp;nbsp; Because the Tap also intersects with the Water Main, I'm using FilterBySubtypeCode to get only the Service Line, which has a SubType of 2.&amp;nbsp; The following code always returns false and I'm not sure what I'm doing wrong.&amp;nbsp; Currently I'm working in a file geodatabase in preparation for conversion to the Utility Network.&amp;nbsp; Any assistance is appreciated.&lt;/P&gt;&lt;P&gt;var TapSize = Intersects((FilterBySubtypeCode(FeatureSetByName($datastore, "WaterLine", ["DIAMETER"], false),2)), $feature) ;&lt;BR /&gt;if (TapSize == $feature.FITTING_SIZE) {&lt;BR /&gt;return true ;&lt;BR /&gt;} ELSE {&lt;BR /&gt;return false&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 19:05:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619041#M96130</guid>
      <dc:creator>SusanONeill1</dc:creator>
      <dc:date>2025-05-28T19:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Attribute Rule for Intersecting feature</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619053#M96132</link>
      <description>&lt;P&gt;The result of Intersects is a feature set of all intersecting features, if you know there's only 1 intersecting feature you can use the First function to quickly grab a feature. You also have to grab a field from the feature for the comparison, and I think passing false for the geometry parameter in&amp;nbsp;&lt;SPAN&gt;FeatureSetByName will cause problems. Therefore:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var tap = First(Intersects(FilterBySubtypeCode(FeatureSetByName($datastore, "WaterLine", ["DIAMETER"], true), 2), $feature));
return tap.tapSize == $feature.FITTING_SIZE&lt;/LI-CODE&gt;&lt;P&gt;I haven't tested this but it should get you going in the right direction.&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 19:36:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619053#M96132</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-05-28T19:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Attribute Rule for Intersecting feature</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619081#M96137</link>
      <description>&lt;P&gt;I tried the code you suggested, but the return statement does not allow a field name, which is what I assume you were calling "tapSize".&amp;nbsp; It gave the error "Unexpected null".&lt;BR /&gt;&lt;BR /&gt;I thought it might make the situation more clear if I change the name of the first variable to sLineDiam since what I am looking for in that statement is the diameter of the Service Line.&amp;nbsp; So I tried this:&lt;BR /&gt;&lt;BR /&gt;var sLineDiam = First(Intersects(FilterBySubtypeCode(FeatureSetByName($datastore, "WaterLine", ["DIAMETER"], true), 2), $feature));&lt;BR /&gt;return sLineDiam == $feature.FITTING_SIZE&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now it's returning an error on all taps within the extent.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Also, can you elaborate on the return statement?&amp;nbsp; I thought a Validation Attribute Rule should return true for valid and false for invalid.&amp;nbsp; Is that implied by the format of your return statement?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 20:22:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619081#M96137</guid>
      <dc:creator>SusanONeill1</dc:creator>
      <dc:date>2025-05-28T20:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Attribute Rule for Intersecting feature</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619089#M96139</link>
      <description>&lt;P&gt;Almost there, we just need to extract the attribute value from the feature returned by First:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sLineDiam = First(Intersects(FilterBySubtypeCode(FeatureSetByName($datastore, "WaterLine", ["DIAMETER"], true), 2), $feature));
return sLineDiam["DIAMETER"] == $feature.FITTING_SIZE&lt;/LI-CODE&gt;&lt;P&gt;Just like JavaScript (and many other programming languages) the "==" operator compares both sides and returns true if they're equivalent or false otherwise. This means you can skip the if/else block as we're returning true/false directly.&lt;/P&gt;&lt;P&gt;If you still get errors, check to see if a Select by Location between the two feature classes works as intended in Pro, you might have features that appear to be coincident but actually aren't.&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 20:31:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619089#M96139</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-05-28T20:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Attribute Rule for Intersecting feature</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619096#M96140</link>
      <description>&lt;P&gt;Thanks for the explanation of the return.&amp;nbsp; I tried your suggestion but I'm back to getting the error "Invalid expression" if I try to include a field name (DIAMETER) in the return statement:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SusanONeill1_0-1748464587643.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/133399i8CD211CB19AF3557/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SusanONeill1_0-1748464587643.png" alt="SusanONeill1_0-1748464587643.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 20:37:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619096#M96140</guid>
      <dc:creator>SusanONeill1</dc:creator>
      <dc:date>2025-05-28T20:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Attribute Rule for Intersecting feature</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619108#M96143</link>
      <description>&lt;P&gt;After standing up some test data and playing around with the rules I was able to replicate that error, and this is what I came up with for a solution:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var intersecting = Intersects(FilterBySubtypeCode(FeatureSetByName($datastore, "WaterLine", ["DIAMETER"], true), 2), $feature);
if (Count(intersecting) == 0) return false
return First(intersecting).DIAMETER == $feature.FITTING_SIZE&lt;/LI-CODE&gt;&lt;P&gt;This adds a "Count" check after the intersection and fails the rule if the feature isn't intersecting any lines. I assume the rule checker was feeding a null into the First which caused that error to pop-up. Wish the error message was better here but either way, that Count check seems to have fixed it. Note that this will fail if you move a fitting off a line, if that's too strict you can change line 2 to return true instead.&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 21:19:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619108#M96143</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-05-28T21:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Attribute Rule for Intersecting feature</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619265#M96161</link>
      <description>&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Thanks so much for your help.&amp;nbsp; I was able to get it to work although at first I was confused with the lack of curly brackets in your code.&amp;nbsp; I'm new to Arcade so maybe they're not always needed?&amp;nbsp; I also needed to check to make sure the fitting was a Tap and not some other type, so I eventually ended up with this:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if($feature.FITTING_TYPE != "TAP") {&lt;BR /&gt;return true;&lt;BR /&gt;} else {&lt;BR /&gt;var intersecting = Intersects(FilterBySubtypeCode(FeatureSetByName($datastore, "WaterLine", ["DIAMETER"], true), 2), $feature);&lt;BR /&gt;if (Count(intersecting) == 0) {&lt;BR /&gt;return false&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;return First(intersecting).DIAMETER == $feature.FITTING_SIZE&lt;BR /&gt;} }&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2025 14:02:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/need-help-with-attribute-rule-for-intersecting/m-p/1619265#M96161</guid>
      <dc:creator>SusanONeill1</dc:creator>
      <dc:date>2025-05-29T14:02:26Z</dc:date>
    </item>
  </channel>
</rss>

