<?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: Validation rule for finding overlaps between a number of different datasets in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/validation-rule-for-finding-overlaps-between-a/m-p/1275106#M794</link>
    <description>&lt;P&gt;You will have to write the code for loading the featuresets, but you can do the intersection in a loop.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var test_featuresets = [
    FeaturesetByName($datastore, "line_a", ["*"], false),
    FeaturesetByName($datastore, "polygon_b", ["*"], false),
    FeaturesetByName($datastore, "polygon_c", ["*"], false),
]

for(var i in test_featuresets) {
    var inter = First(Intersects(test_featuresets[i], $feature))
    if(inter != null) {
        return {"errorMessage": "polygon A features must not be intersected with others."}
    }
}
return true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sidenote: Not too sure about that, but I think you have to return a boolean. errorMessage is for Calculation rules. So you probably want to change the return to false and input the error message in the Validation rule window.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2023 07:26:45 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2023-04-04T07:26:45Z</dc:date>
    <item>
      <title>Validation rule for finding overlaps between a number of different datasets</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/validation-rule-for-finding-overlaps-between-a/m-p/1275025#M788</link>
      <description>&lt;P&gt;Hello people,&lt;/P&gt;&lt;P&gt;Just seeking a better way of detecting&amp;nbsp;overlaps between a number of different datasets by validation rule.&lt;/P&gt;&lt;P&gt;I have a database that contains hundreds of datasets. I have a code for detecting overlaps between different datasets - see below. But in the code, I have to create "Intersects" function for each pair of datasets to detect overlaps. As there are heaps of datasets in the database, I would like to avoid creating heaps of lines for the geometry function. Is there any more sophisticated way of coding to detect overlaps between hundreds of different datasets?&lt;/P&gt;&lt;P&gt;Thanks in advance for your ideas!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;// Validation - overlaps
var poly_b = FeatureSetByName($datastore, "polygon_b", ["*"], false)
var poly_b_intersect = Intersects(poly_b, Geometry($feature))

var line_a = FeatureSetByName($datastore, "line_a", ["*"], false)
var line_a_intersect = Intersects(line_a, Geometry($feature))

var polygon_c = FeatureSetByName($datastore, "polygon_c", ["*"], false)
var polygon_c_intersect = Intersects(polygon_c, Geometry($feature))

// return error if $feature intersect any polygon A
if (Count(poly_b_intersect) &amp;gt; 0 || Count(line_a_intersect) &amp;gt; 0 || Count(polygon_c_intersect) &amp;gt; 0)
    return {"errorMessage": "polygon A features must not be intersected with others."}
else
    return true&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 03 Apr 2023 22:18:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/validation-rule-for-finding-overlaps-between-a/m-p/1275025#M788</guid>
      <dc:creator>Aнастасия88</dc:creator>
      <dc:date>2023-04-03T22:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Validation rule for finding overlaps between a number of different datasets</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/validation-rule-for-finding-overlaps-between-a/m-p/1275106#M794</link>
      <description>&lt;P&gt;You will have to write the code for loading the featuresets, but you can do the intersection in a loop.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var test_featuresets = [
    FeaturesetByName($datastore, "line_a", ["*"], false),
    FeaturesetByName($datastore, "polygon_b", ["*"], false),
    FeaturesetByName($datastore, "polygon_c", ["*"], false),
]

for(var i in test_featuresets) {
    var inter = First(Intersects(test_featuresets[i], $feature))
    if(inter != null) {
        return {"errorMessage": "polygon A features must not be intersected with others."}
    }
}
return true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sidenote: Not too sure about that, but I think you have to return a boolean. errorMessage is for Calculation rules. So you probably want to change the return to false and input the error message in the Validation rule window.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 07:26:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/validation-rule-for-finding-overlaps-between-a/m-p/1275106#M794</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-04-04T07:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Validation rule for finding overlaps between a number of different datasets</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/validation-rule-for-finding-overlaps-between-a/m-p/1275597#M801</link>
      <description>&lt;P&gt;Thanks Johannes for the good ideas!&lt;/P&gt;&lt;P&gt;The errorMessage is the legacy of calculatoin rule that I also prepared - thanks for pointing out.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 22:56:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/validation-rule-for-finding-overlaps-between-a/m-p/1275597#M801</guid>
      <dc:creator>Aнастасия88</dc:creator>
      <dc:date>2023-04-04T22:56:31Z</dc:date>
    </item>
  </channel>
</rss>

