<?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 Arcade:  Intersect or Filter Two Feature Classes to Populate a Related Table in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-intersect-or-filter-two-feature-classes-to/m-p/1356383#M75856</link>
    <description>&lt;P&gt;I have a table that is related (one to one) to my parks feature class.&amp;nbsp; It has park amenity fields (benches, pool, kayak_rental, etc.) with a yes or no value.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Intersect option&lt;/STRONG&gt;&lt;/U&gt;: I want to be able to intersect the parks feature class with our benches feature class and if there is an intersection, write yes or no to the benches field in the related table for that park.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Filter option&lt;/STRONG&gt;&lt;/U&gt;:&amp;nbsp; If the park_name field of the parks fc equals the park_name field of the benches fc, return yes to benches field in the related table for that park.&lt;/P&gt;</description>
    <pubDate>Mon, 04 Dec 2023 17:18:21 GMT</pubDate>
    <dc:creator>ArmstKP</dc:creator>
    <dc:date>2023-12-04T17:18:21Z</dc:date>
    <item>
      <title>Arcade:  Intersect or Filter Two Feature Classes to Populate a Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-intersect-or-filter-two-feature-classes-to/m-p/1356383#M75856</link>
      <description>&lt;P&gt;I have a table that is related (one to one) to my parks feature class.&amp;nbsp; It has park amenity fields (benches, pool, kayak_rental, etc.) with a yes or no value.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Intersect option&lt;/STRONG&gt;&lt;/U&gt;: I want to be able to intersect the parks feature class with our benches feature class and if there is an intersection, write yes or no to the benches field in the related table for that park.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Filter option&lt;/STRONG&gt;&lt;/U&gt;:&amp;nbsp; If the park_name field of the parks fc equals the park_name field of the benches fc, return yes to benches field in the related table for that park.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 17:18:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-intersect-or-filter-two-feature-classes-to/m-p/1356383#M75856</guid>
      <dc:creator>ArmstKP</dc:creator>
      <dc:date>2023-12-04T17:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade:  Intersect or Filter Two Feature Classes to Populate a Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-intersect-or-filter-two-feature-classes-to/m-p/1356441#M75862</link>
      <description>&lt;LI-CODE lang="javascript"&gt;// Calculation Attribute Rule in the point fc
// field: empty
// triggers: insert
// exclude from application evaluation

var parks_fc = FeaturesetByName($datastore, "ParksFC")
var parks_table = FeaturesetByName($datastore, "ParksTable")

var park_polygon
// get the park polygon
// by filtering for the park_name attribute
if(!IsEmpty($feature.park_name)) {
    var p_name = $feature.park_name 
    park_polygon = First(Filter(parks_fc, "park_name = @p_name"))
}
// or by intersecting the bench with the parks fc
if(park_polygon == null) {
    park_polygon = First(Intersects($feature, parks_fc))
}
if(park_polygon == null) { return }  // we couldn't find a corresponding park polygon, abort

// get the related table row
var key = park_polygon.KeyField
var park_row = First(Filter(parks_table, "KeyField = &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/301813"&gt;@Key&lt;/a&gt;"))
if(park_row == null) { return }  // the polygon doesn't have a corresponding table row, abort


// return a dictionary to instruct ArcGIS to update the park table
return {
//    result: attributes: {park_name: park_polygon.park_name}},  // set the bench's park_name field
    edit: [{
        className: "ParksTable",
        updates: [{
            objectID: park_row.OBJECTID,
            attributes: {HasBenches: "Yes"}
        }]
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit lines 6, 7, 12-14, 23, 24, 32, 35 to fit your table and field names.&lt;/P&gt;&lt;P&gt;Further reading for the return dictionary:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 18:07:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-intersect-or-filter-two-feature-classes-to/m-p/1356441#M75862</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-12-04T18:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade:  Intersect or Filter Two Feature Classes to Populate a Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-intersect-or-filter-two-feature-classes-to/m-p/1356566#M75872</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;Thank you, but I am a little lost on this one.&amp;nbsp; I am not so clear from the example given what field names go where.&lt;/P&gt;&lt;P&gt;Parks FC polygon:&amp;nbsp;&amp;nbsp;prod_geodb1.DATAOWNER.ASM_LocationsMPRB_190325&amp;nbsp; park name field: Name_Primary&lt;/P&gt;&lt;P&gt;Benches FC:&amp;nbsp;&amp;nbsp;prod_geodb1.DATAOWNER.ASM_Benches_180824&amp;nbsp; park name field: Name_Primary&lt;/P&gt;&lt;P&gt;Related table:&amp;nbsp;&amp;nbsp;prod_geodb1.DATAOWNER.ASM_ParkAmenities&amp;nbsp; park name field: PARK_NAME&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, we currently do not employ attribute rules.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 20:49:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-intersect-or-filter-two-feature-classes-to/m-p/1356566#M75872</guid>
      <dc:creator>ArmstKP</dc:creator>
      <dc:date>2023-12-04T20:49:40Z</dc:date>
    </item>
  </channel>
</rss>

