<?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: Filtering a layer using another layers attributes with python? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1195491#M57701</link>
    <description>&lt;P&gt;Thanks for the help! I've altered it and now it prints all the events&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;lyr = "Heatmap_Filtered"
events = arcpy.da.SearchCursor(lyr, ['Event'])
unique_events = list(set([row[0] for row in events]))
unique_events
print(unique_events)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where I'm having problem with now is creating the SQL using AddField Delmiters. Where is FC located?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;where_clause = """ {0} = '{1}' """.format(arcpy.AddFieldDelimiters(fc, 'Heatmap_Filtered'), 'Unique_events')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I'd assume I'd just drop the sql expression in select by attribute?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;arcpy.management.SelectLayerByAttribute("RTL", "NEW_SELECTION", "Event” “sql_exp”)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jul 2022 17:17:27 GMT</pubDate>
    <dc:creator>Davec43</dc:creator>
    <dc:date>2022-07-25T17:17:27Z</dc:date>
    <item>
      <title>Filtering a layer using another layers attributes with python?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1193543#M57438</link>
      <description>&lt;P&gt;I've been trying to use Python to automate the geoprocessing I do for a product I have to create weekly, I'm on the last step. One point layer is the "start position" and the other point layer is tracks. The start position and tracks aren't spatially connected but they do share an "event" attribute. Usually I filter down the point layer (tracks) and then pull the events column that I need and do a data query to parse the point layer "start position" down to what I need. How would I do this with Python? Or is there a Geoprocessing tool or tools that I could use?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 17:16:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1193543#M57438</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2022-07-19T17:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering a layer using another layers attributes with python?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1193654#M57457</link>
      <description>&lt;P&gt;Seems to me a good approach is to get the event ID from your selected set into a variable using a cursor, use that to build a SQL expression, and run Select Layer By Attributes to select the points in the other feature layer. If you have to do this many times, be sure and index the datasets by your event attribute so the selections will be faster.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 20:34:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1193654#M57457</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2022-07-19T20:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering a layer using another layers attributes with python?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1193910#M57492</link>
      <description>&lt;P&gt;with arcpy.da.SearchCursor(layer name, ["Event"]) as cur:&lt;BR /&gt;for row in cursor:&lt;/P&gt;&lt;P&gt;I keep getting&amp;nbsp;NameError: name 'layer name' is not defined?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 13:34:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1193910#M57492</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2022-07-20T13:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering a layer using another layers attributes with python?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1193981#M57505</link>
      <description>&lt;P&gt;"layer name" needs to be either a string literal or a string variable containing the name of an existing layer or the path to a dataset.&lt;/P&gt;&lt;P&gt;It's pretty easy to grab the first one this way&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lyr = "name_of_your_layer"
event_id = arcpy.da.SearchCursor(lyr, ['Event']).next()[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 15:13:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1193981#M57505</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2022-07-20T15:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering a layer using another layers attributes with python?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1195491#M57701</link>
      <description>&lt;P&gt;Thanks for the help! I've altered it and now it prints all the events&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;lyr = "Heatmap_Filtered"
events = arcpy.da.SearchCursor(lyr, ['Event'])
unique_events = list(set([row[0] for row in events]))
unique_events
print(unique_events)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where I'm having problem with now is creating the SQL using AddField Delmiters. Where is FC located?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;where_clause = """ {0} = '{1}' """.format(arcpy.AddFieldDelimiters(fc, 'Heatmap_Filtered'), 'Unique_events')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I'd assume I'd just drop the sql expression in select by attribute?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;arcpy.management.SelectLayerByAttribute("RTL", "NEW_SELECTION", "Event” “sql_exp”)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 17:17:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/filtering-a-layer-using-another-layers-attributes/m-p/1195491#M57701</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2022-07-25T17:17:27Z</dc:date>
    </item>
  </channel>
</rss>

