<?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 Attribute Rule to Intersect only visable polygons? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1488577#M84410</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am attempting to run an Attribute rule that runs an Intersect on a polygon layer with stacked polygons. Think of this as Floor levels of a building.&lt;/P&gt;&lt;P&gt;I am attempting to create an attribute rule that will intersect only the visible features on a map and return the existing value.&lt;/P&gt;&lt;P&gt;My code (arcade) is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var fs = FeatureSetByName($datastore, "DBO.EAMFacility", ["fullname"])
var fsIntersect = [Intersects(fs, $feature)]
var loc = Back(fsIntersect)
if (fullname == null) return {"errorMessage": "Area not found."}

return loc.fullname&lt;/LI-CODE&gt;&lt;P&gt;Instead of intersecting layers that are turned on (I'm using definition queries to isolate Assets and Facilities based on Floor level), it is returning the first polygon it encounters.&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jun 2024 23:58:22 GMT</pubDate>
    <dc:creator>amarcz_cc</dc:creator>
    <dc:date>2024-06-10T23:58:22Z</dc:date>
    <item>
      <title>Attribute Rule to Intersect only visable polygons?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1488577#M84410</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am attempting to run an Attribute rule that runs an Intersect on a polygon layer with stacked polygons. Think of this as Floor levels of a building.&lt;/P&gt;&lt;P&gt;I am attempting to create an attribute rule that will intersect only the visible features on a map and return the existing value.&lt;/P&gt;&lt;P&gt;My code (arcade) is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var fs = FeatureSetByName($datastore, "DBO.EAMFacility", ["fullname"])
var fsIntersect = [Intersects(fs, $feature)]
var loc = Back(fsIntersect)
if (fullname == null) return {"errorMessage": "Area not found."}

return loc.fullname&lt;/LI-CODE&gt;&lt;P&gt;Instead of intersecting layers that are turned on (I'm using definition queries to isolate Assets and Facilities based on Floor level), it is returning the first polygon it encounters.&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 23:58:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1488577#M84410</guid>
      <dc:creator>amarcz_cc</dc:creator>
      <dc:date>2024-06-10T23:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Intersect only visable polygons?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1488871#M84428</link>
      <description>&lt;P&gt;If you've got definition queries that are working to restrict visibility, I assume you've got good attribute data - that's what I'd rely on in this case. Include a check against an attribute as part of the IF statements. As an example, you might attempt something like:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var fs = FeatureSetByName($datastore, "DBO.EAMFacility", ["fullname"])
var fsIntersect = [Intersects(fs, $feature)]
var loc = Back(fsIntersect)
if (fullname == null) return {"errorMessage": "Area not found."}
else if ($feature.FloorNumber == 1){return "something"}
//etc

return loc.fullname&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 11 Jun 2024 13:11:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1488871#M84428</guid>
      <dc:creator>ZachBodenner</dc:creator>
      <dc:date>2024-06-11T13:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Intersect only visable polygons?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1488883#M84432</link>
      <description>&lt;P&gt;Thanks for your response, I suppose my only issue with adding an IF statement is that the Asset layer, the one I'm attempting to get Facility info into, currently doesn't have FloorNumber field in it. I was attempting to make it as simple as possible so my Staff doesn't have to think about it.&lt;/P&gt;&lt;P&gt;Ideally, when the paired feature classes are turned on in the Web Application (IE: Facilities of City Hall Floor 1 &amp;amp; Assets of City Hall Floor 1) as a grouped Feature Service. When you add a new Asset, it reads the Facilities Room and adds it to the location field.&lt;/P&gt;&lt;P&gt;You may be correct where I have to preload the Asset with that Floor level to get the Attribute rule to identify its location.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 14:02:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1488883#M84432</guid>
      <dc:creator>amarcz_cc</dc:creator>
      <dc:date>2024-06-11T14:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Intersect only visable polygons?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1488919#M84437</link>
      <description>&lt;P&gt;If you have the ability to do that I think it would be a good idea but of course it's not always a given that we can control the data schema.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 15:03:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1488919#M84437</guid>
      <dc:creator>ZachBodenner</dc:creator>
      <dc:date>2024-06-11T15:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Intersect only visable polygons?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1491118#M84504</link>
      <description>&lt;P&gt;The only issue I am seeing is on&amp;nbsp; Line 5&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;else if ($feature.FloorNumber == 1){return "something"}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Where I'd want the $feature.FloorName to read the input of the User, then check for a similar attribute in the DBO.EAMFacility fullname field to return a result. Any ideas on how to make that occur?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 22:23:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1491118#M84504</guid>
      <dc:creator>amarcz_cc</dc:creator>
      <dc:date>2024-06-12T22:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Intersect only visable polygons?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1491708#M84519</link>
      <description>&lt;P&gt;Could you identify that as a variable as well?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var floor = $feature.FloorNumber
var facilities = featuresetbyportaitem(
  Portal('&amp;lt;portal URL&amp;gt;'),
  '&amp;lt;itemID&amp;gt;',
  &amp;lt;layerIndex&amp;gt;,
var fInter  = Insersects($feature, facilities)
for (var f in fInter){
// ...
if (floor = f.FloorNumber){return "something"}
}&lt;/LI-CODE&gt;&lt;P&gt;I'm kind of spitballing because I'm not sure how your data is setup, but you could give that a try. Iterate through the facilities and use the if statement within the for loop to check for matching floor numbers?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 13:31:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1491708#M84519</guid>
      <dc:creator>ZachBodenner</dc:creator>
      <dc:date>2024-06-13T13:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Intersect only visable polygons?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1491738#M84521</link>
      <description>&lt;P&gt;Hmm, my attempts have only returned an array of the possible values, and I can't seem to get it to just return the matching value.&lt;/P&gt;&lt;TABLE border="1" width="103.0201728151574%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;&lt;STRONG&gt;Feature&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="15.075479396164832%" height="25px"&gt;&lt;STRONG&gt;EAMIT Assets&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="19.96124031007752%" height="25px"&gt;example&lt;/TD&gt;&lt;TD width="15.182578539371685%" height="25px"&gt;&lt;STRONG&gt;EAMIT Facility&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="48.385453036136184%" height="25px"&gt;example&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;Fields&lt;/TD&gt;&lt;TD width="15.075479396164832%" height="25px"&gt;facility&lt;/TD&gt;&lt;TD width="19.96124031007752%" height="25px"&gt;ie: City Hall Floor 1&lt;/TD&gt;&lt;TD width="15.182578539371685%" height="25px"&gt;facilityname&lt;/TD&gt;&lt;TD width="48.385453036136184%" height="25px"&gt;ie: City Hall&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="15.075479396164832%" height="40px"&gt;location&lt;/TD&gt;&lt;TD width="19.96124031007752%" height="40px"&gt;ie: City Hall Floor 1 IT Office&lt;/TD&gt;&lt;TD width="15.182578539371685%" height="40px"&gt;facilityfloor&lt;/TD&gt;&lt;TD width="48.385453036136184%" height="40px"&gt;&lt;P&gt;ie: Floor 1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD height="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD height="40px"&gt;facilityroom&lt;/TD&gt;&lt;TD height="40px"&gt;&lt;P&gt;ie: IT Office&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;location&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;ie: City Hall Floor 1 IT Office&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I was first attempting a simpler intersect script, but since my polygons are stacking, it would only provide me with the first option.&lt;/P&gt;&lt;P&gt;The second though process was to manually add the EAMITAsset.facility field and have my users select that from a domain list. Then using this feature, have the script compare from a list created by the intersection and input the matching location.&lt;/P&gt;&lt;P&gt;My current script below will give me the result of :&amp;nbsp;["City Hall Basement","City Hall Floor 1","City Hall Floor 2"]&lt;/P&gt;&lt;P&gt;Any help cleaning it up would be amazing!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// identify the intersecting polygon and fields
var fs = FeatureSetByName($datastore, "DBO.EAMFacility", ["fullname","facilityname","facilityfloor","facilityroom"])

// intersect the point (fs) and polygon (fsIntersect)
var fsIntersect = Intersects(fs, $feature)

// create a list of available values
var results = [];
for (var f in fsIntersect){
// return the values in the form of 'City Hall Floor 1' for example
  results[Count(results)] =  Concatenate(f.facilityname, " ", f.facilityfloor,)
// attempt at matching the results to the feature and returning the matching value.
//**I believe this is the messed up portion of the script
  for (var x in f){
    if (results == $feature.Facility) return (x.fullname)
}
}
return results;&lt;/LI-CODE&gt;&lt;P&gt;The ultimate goal is to get the EAMITFacility.location into the EAMITAsset.location field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 14:28:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1491738#M84521</guid>
      <dc:creator>amarcz_cc</dc:creator>
      <dc:date>2024-06-13T14:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Intersect only visable polygons?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1491809#M84530</link>
      <description>&lt;P&gt;I don't have a lot of experience dealing with arrays, but I will say that the part your comments say is messed up is actually basically what I would have done (paired with your concatenate, I would think you're on the right track with matching var results to $feature.Facility). I'm not sure I know what's going on, so if there's anyone else who is watching this threat who notices something, I'd defer to them.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 15:07:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-intersect-only-visable-polygons/m-p/1491809#M84530</guid>
      <dc:creator>ZachBodenner</dc:creator>
      <dc:date>2024-06-13T15:07:22Z</dc:date>
    </item>
  </channel>
</rss>

