<?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 Issues with Arcade Attribute Rules for Road Data Checks in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/issues-with-arcade-attribute-rules-for-road-data/m-p/1573336#M91704</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to create an attribute rule that checks to make sure a divided highway exists for each median. Not sure if the logic is incorrect or if I'm misunderstanding the spatial relationship. It is flagging some correctly and some not. If a median does not have a divided highway on it, it may be correctly flagged, but another one close by will not get flagged (even tho it should).&amp;nbsp; Here is the code and a picture. in the pic, the median running north south (greenish line) should also be red (error) as it doesn't have a divided highway underneath&lt;/P&gt;&lt;P&gt;This started with a clean dataset and deleted divided highways to test. In the clean data, each median will share the same route ID as a divided highway. I tried to flag errors based on attributes to keep it simple. I added in a spatial check but that still doesn't work.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="median_rule_error.PNG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/122895i472BAC95B0B333DE/image-size/large?v=v2&amp;amp;px=999" role="button" title="median_rule_error.PNG" alt="median_rule_error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Check if the median is active (TO_DATE is NULL)
if (IsEmpty($feature.TO_DATE)) {

    //Get Divided Highways
    var highways = FeatureSetByName($datastore, "Divided_Highway_Export", ['ROUTE_ID'], false);
    var hwyRouteID = $feature.ROUTE_ID;

    // Filter highways by ROUTE_ID
    var matchingHighways = Filter(highways, "ROUTE_ID = @hwyRouteID");

    // Flag if NO matching highways were found
    if (Count(matchingHighways) == 0) {
        return true // flag median: no matching div hwy found
    }

    //Spatial check
    var intersectingHighways = Intersects($feature, First(matchingHighways))

    //Flag if no intersecting highway
    if (intersectingHighways) {
        return true //flag median
    }
    //If both conditions are true, pass validation
    return false
} else {
    return true; // Skip validation for retired medians
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;thanks for any help&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jan 2025 21:25:57 GMT</pubDate>
    <dc:creator>Smileyk_mdt</dc:creator>
    <dc:date>2025-01-07T21:25:57Z</dc:date>
    <item>
      <title>Issues with Arcade Attribute Rules for Road Data Checks</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/issues-with-arcade-attribute-rules-for-road-data/m-p/1573336#M91704</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to create an attribute rule that checks to make sure a divided highway exists for each median. Not sure if the logic is incorrect or if I'm misunderstanding the spatial relationship. It is flagging some correctly and some not. If a median does not have a divided highway on it, it may be correctly flagged, but another one close by will not get flagged (even tho it should).&amp;nbsp; Here is the code and a picture. in the pic, the median running north south (greenish line) should also be red (error) as it doesn't have a divided highway underneath&lt;/P&gt;&lt;P&gt;This started with a clean dataset and deleted divided highways to test. In the clean data, each median will share the same route ID as a divided highway. I tried to flag errors based on attributes to keep it simple. I added in a spatial check but that still doesn't work.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="median_rule_error.PNG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/122895i472BAC95B0B333DE/image-size/large?v=v2&amp;amp;px=999" role="button" title="median_rule_error.PNG" alt="median_rule_error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Check if the median is active (TO_DATE is NULL)
if (IsEmpty($feature.TO_DATE)) {

    //Get Divided Highways
    var highways = FeatureSetByName($datastore, "Divided_Highway_Export", ['ROUTE_ID'], false);
    var hwyRouteID = $feature.ROUTE_ID;

    // Filter highways by ROUTE_ID
    var matchingHighways = Filter(highways, "ROUTE_ID = @hwyRouteID");

    // Flag if NO matching highways were found
    if (Count(matchingHighways) == 0) {
        return true // flag median: no matching div hwy found
    }

    //Spatial check
    var intersectingHighways = Intersects($feature, First(matchingHighways))

    //Flag if no intersecting highway
    if (intersectingHighways) {
        return true //flag median
    }
    //If both conditions are true, pass validation
    return false
} else {
    return true; // Skip validation for retired medians
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;thanks for any help&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 21:25:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/issues-with-arcade-attribute-rules-for-road-data/m-p/1573336#M91704</guid>
      <dc:creator>Smileyk_mdt</dc:creator>
      <dc:date>2025-01-07T21:25:57Z</dc:date>
    </item>
  </channel>
</rss>

