<?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: How do I get a specific field name with arcpy? in ArcMap Questions</title>
    <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014371#M1830</link>
    <description>&lt;P&gt;Further to Dan's point, you should probably pass third_fld within a list as the last argument.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.JoinField_management(fc_in, joinfld1, gdb_table, joinfld2, [third_fld]) &lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 06 Jan 2021 18:34:16 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2021-01-06T18:34:16Z</dc:date>
    <item>
      <title>How do I get a specific field name with arcpy?</title>
      <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014125#M1820</link>
      <description>&lt;P&gt;I have a geodatabase table with three fields. After creating a list of fields with arcpy, how do I reference just the third field to acquire the fieldname for use in the next arcpy statement?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 22:26:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014125#M1820</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-01-05T22:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a specific field name with arcpy?</title>
      <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014133#M1821</link>
      <description>&lt;LI-CODE lang="python"&gt;&amp;gt;&amp;gt;&amp;gt; l = ["field1", "field2", "field3"]
&amp;gt;&amp;gt;&amp;gt; l[2]
'field3'
&amp;gt;&amp;gt;&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Jan 2021 22:32:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014133#M1821</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-01-05T22:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a specific field name with arcpy?</title>
      <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014135#M1822</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/listfields.htm" target="_blank"&gt;ListFields—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;assuming&lt;/P&gt;&lt;LI-CODE lang="python"&gt;field_names = [f.name for f in arcpy.ListFields(featureclass)]
third_fld = field_names[2]&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Jan 2021 22:33:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014135#M1822</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-01-05T22:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a specific field name with arcpy?</title>
      <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014181#M1824</link>
      <description>&lt;P&gt;This will fail when cursor is fetching mentioned fields only, better to Collect field names from Cursor not from feature class.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 05:40:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014181#M1824</guid>
      <dc:creator>jrneyulu</dc:creator>
      <dc:date>2021-01-06T05:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a specific field name with arcpy?</title>
      <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014249#M1827</link>
      <description>&lt;P&gt;What do you mean by 'mentioned fields'?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 13:24:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014249#M1827</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-06T13:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a specific field name with arcpy?</title>
      <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014350#M1828</link>
      <description>&lt;P&gt;This is similar to the procedure I came up with yesterday after many trials and errors:&lt;/P&gt;&lt;PRE&gt;third_fld = arcpy.ListFields(gdb_table)[&lt;SPAN&gt;2&lt;/SPAN&gt;]&lt;/PRE&gt;&lt;P&gt;I could get it to print the name of the correct field with:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;'Field is {0}.'.format(thrid_fld.name&lt;/SPAN&gt;))&lt;/PRE&gt;&lt;P&gt;I could not, however, pass the field name into the JoinField tool with:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;arcpy.JoinField_management(fc_in, joinfld1, gdb_table, joinfld2, third_fld)&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I'm guessing I am missing something and to simply reference 'third_fld' in the JoinField statement is generating the error:&lt;/P&gt;&lt;P&gt;Runtime error&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 65, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "c:\program files (x86)\arcgis\desktop10.8\arcpy\arcpy\management.py", line 6587, in JoinField&lt;BR /&gt;raise e&lt;BR /&gt;RuntimeError: Object: Error in executing tool&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 17:45:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014350#M1828</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-01-06T17:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a specific field name with arcpy?</title>
      <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014351#M1829</link>
      <description>&lt;P&gt;third_fld ...thrid_fld ... third_fld&lt;/P&gt;&lt;P&gt;Consistency? Is this a copy-paste issue on your pare or is that what you have in your code?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 17:50:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014351#M1829</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-01-06T17:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a specific field name with arcpy?</title>
      <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014371#M1830</link>
      <description>&lt;P&gt;Further to Dan's point, you should probably pass third_fld within a list as the last argument.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.JoinField_management(fc_in, joinfld1, gdb_table, joinfld2, [third_fld]) &lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 06 Jan 2021 18:34:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014371#M1830</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-06T18:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a specific field name with arcpy?</title>
      <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014393#M1831</link>
      <description>&lt;P&gt;Typing issue - the code was correct.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 19:26:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014393#M1831</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-01-06T19:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a specific field name with arcpy?</title>
      <link>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014396#M1832</link>
      <description>&lt;P&gt;I got this to work. A couple of issues - it never worked in ArcMap but did in Pro. Plus I changed the interpreter within Pycharm to ver 3.7. And added the brackets around third_fld.&lt;/P&gt;&lt;P&gt;Thanks everyone!!&lt;/P&gt;&lt;P&gt;Pam&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 19:28:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/how-do-i-get-a-specific-field-name-with-arcpy/m-p/1014396#M1832</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-01-06T19:28:09Z</dc:date>
    </item>
  </channel>
</rss>

