<?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: Trying to use arcpy find duplicates in layers from mxd.  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166610#M12845</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Firstly, it would be helpful to community members if you formatted the code in your post: &lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting?sr=search&amp;amp;searchId=02fa3b47-d128-40af-9c35-fb69e3ab521f&amp;amp;searchIndex=0"&gt;/blogs/dan_patterson/2016/08/14/script-formatting?sr=search&amp;amp;searchId=02fa3b47-d128-40af-9c35-fb69e3ab521f&amp;amp;searchIndex=0&lt;/A&gt;‌.&amp;nbsp; Secondly, I suggest you take a look at Python &lt;A href="https://docs.python.org/2/library/string.html#format-string-syntax"&gt;Format String Syntax&lt;/A&gt;.&amp;nbsp; The line where you are building your SQL WHERE statement is very difficult to read with the long string (no pun intended) of concatenations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You say the code isn't cooperating, what are you expecting it to do and what is it actually doing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Jun 2018 14:08:25 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2018-06-13T14:08:25Z</dc:date>
    <item>
      <title>Trying to use arcpy find duplicates in layers from mxd.</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166609#M12844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Basically i want to find duplicate records from my attribute tables in my mxd not my data base because my mxd. has several definition query's i would like to preserve. I am essentially trying to script this query&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE class="" style="color: #595959; background-color: whitesmoke; font-weight: 300; font-size: 0.9rem; margin-bottom: 1.55rem; padding: 10px;"&gt;[FIELD_NAME] In (SELECT [FIELD_NAME] FROM [TABLE_NAME] GROUP BY [FIELD_NAME] HAVING Count(*)&amp;gt;1 )&lt;/PRE&gt;&lt;P&gt;Any tips as to why this wont cooperate? I either get a cannot combine string and layer objects error or an invalid query error because it says my layer does not exist because it wont find the table related to my mxd.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Set workspace environments. Workspace must be a connection file to an ADMIN (sde) connection&lt;BR /&gt;arcpy.env.workspace = r"\\fs\GIS\admin\temp_connect_files\COF_temp.sde"&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;print "workspace environment connected"&lt;BR /&gt;# Set workspace variable&lt;BR /&gt;workspace = arcpy.env.workspace&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Local variables:&lt;BR /&gt; &lt;BR /&gt;mxd = arcpy.mapping.MapDocument(r"P:\Joey_Plessis\service_cards\pdf_map_automation_script\DEFAULT_bc_one_call.mxd")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;df = arcpy.mapping.ListDataFrames(mxd,"*")[0] #DONT WORRY ABOUT THIS PART&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;layer = arcpy.mapping.ListLayers(mxd, raw_input("enter layer name"), df)[0]&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;field = raw_input("enter field name")&lt;BR /&gt; &lt;BR /&gt;print layer&lt;BR /&gt;print field&lt;BR /&gt;where = field +" " + "In" + " " + "(SELECT" +" "+ field + " "+ "FROM" +" " + "layer" + " "+ "GROUP BY" +" " + field +" "+ "HAVING Count(*)&amp;gt;1 )"&lt;BR /&gt;print where&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION" ,where)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2018 23:04:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166609#M12844</guid>
      <dc:creator>StudentFernie</dc:creator>
      <dc:date>2018-06-12T23:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use arcpy find duplicates in layers from mxd.</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166610#M12845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Firstly, it would be helpful to community members if you formatted the code in your post: &lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting?sr=search&amp;amp;searchId=02fa3b47-d128-40af-9c35-fb69e3ab521f&amp;amp;searchIndex=0"&gt;/blogs/dan_patterson/2016/08/14/script-formatting?sr=search&amp;amp;searchId=02fa3b47-d128-40af-9c35-fb69e3ab521f&amp;amp;searchIndex=0&lt;/A&gt;‌.&amp;nbsp; Secondly, I suggest you take a look at Python &lt;A href="https://docs.python.org/2/library/string.html#format-string-syntax"&gt;Format String Syntax&lt;/A&gt;.&amp;nbsp; The line where you are building your SQL WHERE statement is very difficult to read with the long string (no pun intended) of concatenations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You say the code isn't cooperating, what are you expecting it to do and what is it actually doing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2018 14:08:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166610#M12845</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-06-13T14:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use arcpy find duplicates in layers from mxd.</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166611#M12846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/330392" target="_blank"&gt;Student Fernie&lt;/A&gt;‌, I see you updated your original post with some more information.&amp;nbsp; In terms of code formatting, I was thinking more along the lines of:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# Set workspace environments. Workspace must be a connection file to an ADMIN (sde) connection&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"\\fs\GIS\admin\temp_connect_files\COF_temp.sde"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"workspace environment connected"&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Set workspace variable&lt;/SPAN&gt;
workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace


&lt;SPAN class="comment token"&gt;# Local variables:&lt;/SPAN&gt;

mxd &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapDocument&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"P:\Joey_Plessis\service_cards\pdf_map_automation_script\DEFAULT_bc_one_call.mxd"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


df &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListDataFrames&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"*"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#DONT WORRY ABOUT THIS PART&lt;/SPAN&gt;


layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; raw_input&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"enter layer name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; df&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;


field &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; raw_input&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"enter field name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; layer
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; field
where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; field &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"In"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"(SELECT"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; field &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"FROM"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"layer"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"GROUP BY"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; field &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"HAVING Count(*)&amp;gt;1 )"&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; where


arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;where&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With regard to your first issue, i.e., "get a cannot combine string and layer objects error," you have already written the answer.&amp;nbsp; &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;arcpy.mapping.ListLayers&lt;/SPAN&gt; returns a list of ArcPy Mapping Layer objects.&amp;nbsp; You can't concatenate an object to a string, just like you can't concatenate an integer or float to a string, the data types don't support doing so:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"string"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; object&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Runtime error 
Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp; File &lt;SPAN class="string token"&gt;"&amp;lt;string&amp;gt;"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
TypeError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; cannot concatenate &lt;SPAN class="string token"&gt;'str'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;and&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'object'&lt;/SPAN&gt; objects
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; 
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"string"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
Runtime error 
Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp; File &lt;SPAN class="string token"&gt;"&amp;lt;string&amp;gt;"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
TypeError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; cannot concatenate &lt;SPAN class="string token"&gt;'str'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;and&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'int'&lt;/SPAN&gt; objects
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; 
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"string"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
Runtime error 
Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp; File &lt;SPAN class="string token"&gt;"&amp;lt;string&amp;gt;"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
TypeError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; cannot concatenate &lt;SPAN class="string token"&gt;'str'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;and&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'float'&lt;/SPAN&gt; objects
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ArcPy Layer objects store their name in a property named "name", which you can concatenate to a string since the property returns a Unicode string.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; lyr
&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;map layer u&lt;SPAN class="string token"&gt;'map layer'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; 
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name
u&lt;SPAN class="string token"&gt;'map layer'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; ‍‍‍‍‍
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"string "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name
u&lt;SPAN class="string token"&gt;'string map layer'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:41:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166611#M12846</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T08:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use arcpy find duplicates in layers from mxd.</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166612#M12847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok got that error figured, now it wont point to the table.&lt;/P&gt;&lt;P&gt;thanks for your help!&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Traceback (most recent call last):
 File "P:\Joey_Plessis\find_dupes_mxd_edition\find_dupes_mxd.py", line 54, in &amp;lt;module&amp;gt;
 print layer.name.table
AttributeError: 'unicode' object has no attribute 'table'
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:41:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166612#M12847</guid>
      <dc:creator>StudentFernie</dc:creator>
      <dc:date>2021-12-11T08:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use arcpy find duplicates in layers from mxd.</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166613#M12848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;my apologies, what im trying to do is now link to the layers table so I can complete my query.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2018 20:37:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166613#M12848</guid>
      <dc:creator>StudentFernie</dc:creator>
      <dc:date>2018-06-13T20:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use arcpy find duplicates in layers from mxd.</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166614#M12849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You appear to be struggling with the basic structure of the ArcPy Mapping module.&amp;nbsp; I encourage you to spend some time reading the &lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/introduction-to-arcpy-mapping.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/introduction-to-arcpy-mapping.htm"&gt;Introduction to arcpy.mapping—Help | ArcGIS Desktop&lt;/A&gt; .&amp;nbsp; Regarding your error message specifically, the &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;name&lt;/SPAN&gt; property of a layer object returns a Unicode string, as I mention above.&amp;nbsp; Python strings have no property or method named "table," hence the error message.&amp;nbsp; What you need to look into is either &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;datasetName&lt;/SPAN&gt; or &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;dataSource&lt;/SPAN&gt; properties of &lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm"&gt;Layer—Help | ArcGIS Desktop.&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2018 21:00:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166614#M12849</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-06-13T21:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use arcpy find duplicates in layers from mxd.</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166615#M12850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look man I get my scripting sucks, I just need a solution. how do I point to my layer table so i can throw a variable into my query&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2018 21:07:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166615#M12850</guid>
      <dc:creator>StudentFernie</dc:creator>
      <dc:date>2018-06-13T21:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use arcpy find duplicates in layers from mxd.</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166616#M12851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As I mention above, you need to look into either &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;datasetName&lt;/SPAN&gt; or &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;dataSource&lt;/SPAN&gt; properties of &lt;A class="" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fdesktop.arcgis.com%2Fen%2Farcmap%2Flatest%2Fanalyze%2Farcpy-mapping%2Flayer-class.htm" rel="nofollow" target="_blank"&gt;Layer—Help | ArcGIS Desktop.&lt;/A&gt;&amp;nbsp; I am willing to help folks work through problems, and especially help them learn about Python and ArcPy, but I don't have the time to do other people's work for them, so I am done here.&amp;nbsp; Best of luck, maybe someone else will find the time to give you a solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 14:39:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166616#M12851</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-06-14T14:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use arcpy find duplicates in layers from mxd.</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166617#M12852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or like you know just say, replace layer.table with layer.datasetName..........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GOT IT NOW THANKS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 16:47:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-arcpy-find-duplicates-in-layers-from/m-p/166617#M12852</guid>
      <dc:creator>StudentFernie</dc:creator>
      <dc:date>2018-06-14T16:47:04Z</dc:date>
    </item>
  </channel>
</rss>

