<?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: Selecting By Attribute and preforming function in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039401#M60529</link>
    <description>&lt;P&gt;Use variables.&amp;nbsp; &amp;nbsp;It's also a good practice to use Feature layers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Create Buffer Layer
buff = arcpy.Buffer_analysis(Centroid_Map_XYTableToPoint, buffer, "200 kilometers")
buffFeatureLayer = arcpy.MakeFeatureLayer_management(buff, "buff_layer")
print("Buffer Layer Created")


# arcpy.management.SelectLayerByAttribute(in_layer_or_view, {selection_type}, {where_clause}, {invert_where_clause})
selectLayer = arcpy.SelectLayerByAttribute_management("Lakehead_Forest_Processing", "NEW_SELECTION", "FMU_NAME = 'Lakehead Forest' ")

print("Layer Selected")

# arcpy.analysis.Clip(in_features, clip_features, out_feature_class, {cluster_tolerance})
arcpy.analysis.Clip(selectLayer, buffFeatureLayer, "Clipped_Layer")

print("clip successful")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Mar 2021 17:49:21 GMT</pubDate>
    <dc:creator>MatthewDriscoll</dc:creator>
    <dc:date>2021-03-22T17:49:21Z</dc:date>
    <item>
      <title>Selecting By Attribute and preforming function</title>
      <link>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039356#M60526</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm pretty new to ArcGIS Python scripting, I hope this question isn't dumb. How would clip/intersect after selecting that layer in ArcPy based on a specific attribute? . When I write out the statement to select by a specific attribute, then write out a clip or intersect statement right after, it seems to completely ignore that I just wrote a selection by attribute statement above it. The function just completes on the entire layer rather than the selection.&lt;/P&gt;&lt;P&gt;I've already looked at the help section for both to see if I was messing up in the syntax, to no avail. Any suggestions?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 16:12:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039356#M60526</guid>
      <dc:creator>KeoniJames-Ashkewe</dc:creator>
      <dc:date>2021-03-22T16:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting By Attribute and preforming function</title>
      <link>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039375#M60527</link>
      <description>&lt;P&gt;Sharing your code would be a good first step&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 16:42:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039375#M60527</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-03-22T16:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting By Attribute and preforming function</title>
      <link>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039391#M60528</link>
      <description>&lt;P&gt;Here it is - my question is how to carry on the selected layer? Or if there's a was I was write in the clip statement to select a specific attribute in the table.&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;print("ArcPy Imported ")&lt;/P&gt;&lt;P&gt;#set variables&lt;/P&gt;&lt;P&gt;# chose an output database&lt;BR /&gt;arcpy.env.workspace = r'C:\Users\JAMES KEONI\Documents\ArcGIS\Projects\Flow Map\Flow Map.gdb'&lt;BR /&gt;print("Workspace Created")&lt;/P&gt;&lt;P&gt;# arcpy.env.workspace = "C:/data" arcpy.Buffer_analysis("roads", "C:/output/majorrdsBuffered", "100 Feet", "FULL",&lt;BR /&gt;# "ROUND", "LIST", "Distance")&lt;BR /&gt;path = r'C:\Users\JAMES KEONI\Documents\ArcGIS\Projects\Flow Map\Buffer'&lt;BR /&gt;print("Path Created")&lt;/P&gt;&lt;P&gt;# Create Buffer Layer&lt;BR /&gt;arcpy.Buffer_analysis(Centroid_Map_XYTableToPoint, buffer, "200 kilometers")&lt;BR /&gt;print("Buffer Layer Created")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# arcpy.management.SelectLayerByAttribute(in_layer_or_view, {selection_type}, {where_clause}, {invert_where_clause})&lt;BR /&gt;arcpy.SelectLayerByAttribute_management("Lakehead_Forest_Processing", "NEW_SELECTION", "FMU_NAME = 'Lakehead Forest' ")&lt;/P&gt;&lt;P&gt;print("Layer Selected")&lt;/P&gt;&lt;P&gt;# arcpy.analysis.Clip(in_features, clip_features, out_feature_class, {cluster_tolerance})&lt;BR /&gt;arcpy.analysis.Clip("Lakehead_Forest_Processing", "Buffer", "Clipped_Layer")&lt;/P&gt;&lt;P&gt;print("clip successful")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 17:25:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039391#M60528</guid>
      <dc:creator>KeoniJames-Ashkewe</dc:creator>
      <dc:date>2021-03-22T17:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting By Attribute and preforming function</title>
      <link>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039401#M60529</link>
      <description>&lt;P&gt;Use variables.&amp;nbsp; &amp;nbsp;It's also a good practice to use Feature layers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Create Buffer Layer
buff = arcpy.Buffer_analysis(Centroid_Map_XYTableToPoint, buffer, "200 kilometers")
buffFeatureLayer = arcpy.MakeFeatureLayer_management(buff, "buff_layer")
print("Buffer Layer Created")


# arcpy.management.SelectLayerByAttribute(in_layer_or_view, {selection_type}, {where_clause}, {invert_where_clause})
selectLayer = arcpy.SelectLayerByAttribute_management("Lakehead_Forest_Processing", "NEW_SELECTION", "FMU_NAME = 'Lakehead Forest' ")

print("Layer Selected")

# arcpy.analysis.Clip(in_features, clip_features, out_feature_class, {cluster_tolerance})
arcpy.analysis.Clip(selectLayer, buffFeatureLayer, "Clipped_Layer")

print("clip successful")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 17:49:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039401#M60529</guid>
      <dc:creator>MatthewDriscoll</dc:creator>
      <dc:date>2021-03-22T17:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting By Attribute and preforming function</title>
      <link>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039543#M60533</link>
      <description>&lt;P&gt;You are passing a feature &lt;EM&gt;class&lt;/EM&gt; to&amp;nbsp;SelectLayerByAttribute and not using the returned feature &lt;EM&gt;layer&lt;/EM&gt; (which has the selection applied). And then passing the original feature&amp;nbsp;&lt;EM&gt;class&lt;/EM&gt; to the next tool.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/feature-class-basics.htm" target="_self"&gt;Feature classes&lt;/A&gt;&amp;nbsp;are the actual data (on disk, in a geodatabase, in the cloud, etc.) and in ArcGIS can't have selections (or symbology, joins, etc.). &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/feature-layers.htm" target="_self"&gt;Feature layers&lt;/A&gt;&amp;nbsp;are a representation of a feature class that are a link to the feature class and can also have&amp;nbsp;selections (and symbology, joins, etc.).&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 22:33:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1039543#M60533</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-03-22T22:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting By Attribute and preforming function</title>
      <link>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1171440#M64512</link>
      <description>&lt;P&gt;I am new to using arcpy. I have a very similar question, how would be a code to intersect by attributes?&lt;BR /&gt;thank you&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 13:29:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-by-attribute-and-preforming-function/m-p/1171440#M64512</guid>
      <dc:creator>JavierBarboza</dc:creator>
      <dc:date>2022-05-06T13:29:28Z</dc:date>
    </item>
  </channel>
</rss>

