<?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: Question about JoinField_Management?? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/question-about-joinfield-management/m-p/626318#M48824</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Arek, my bad I forgot one layer is a gdb. Is this the right code for joining 2 fields in a shapefile and 2 fields in a gdb??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, traceback
from arcpy import env


mxd = arcpy.mapping.MapDocument("CURRENT")

# Join Fields
fc1 = 'K:\TASS\4_MAPPING_DATA_SUPPORT\Traffic_Mapping\Traffic_Count_Data\2011_Counts\2011_Annual_Stations\Annual_Stations_2011.shp'
fc2 = 'K:\TASS\4_MAPPING_DATA_SUPPORT\Traffic_Mapping\Traffic_Count_Data\District_Labels_Folder\Abilene_Labels.gdb'

fields_to_join = ['!F2011_TRAF!', '!FLAG!']
arcpy.AddField_management(fc1, 'COUNT', 'TEXT')
arcpy.CalculateField_management(fc1, 'COUNT', ''.join(fields_to_join), 'PYTHON')

fields_to_join = ['!TextString!', '!TFLAG!']
arcpy.AddField_management(fc2, 'TRAFFIC', 'TEXT')
arcpy.CalculateField-management(fc2, 'TRAFFIC', ''.join(fields_to_join), 'PYTHON')

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:41:11 GMT</pubDate>
    <dc:creator>MichelleCouden1</dc:creator>
    <dc:date>2021-12-12T02:41:11Z</dc:date>
    <item>
      <title>Question about JoinField_Management??</title>
      <link>https://community.esri.com/t5/python-questions/question-about-joinfield-management/m-p/626316#M48822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can anyone direct me to where it shows how to code for joining of two fields in the same layer. I found Join Field (Data Management) on Help desk, but the examples for python on the bottom are terrible.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2013 12:55:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-joinfield-management/m-p/626316#M48822</guid>
      <dc:creator>MichelleCouden1</dc:creator>
      <dc:date>2013-04-30T12:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Question about JoinField_Management??</title>
      <link>https://community.esri.com/t5/python-questions/question-about-joinfield-management/m-p/626317#M48823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you want to create filed that contains joined values from two other field? If so, what you're looking for is combination of&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddField_mangement and arcpy.CalculateField_management.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
fields_to_join = ['!FIELD_NAME_1!', '!FIELD_NAME_2!'] # don't forget exclamation marks!
fc = 'C:/example.shp'
arcpy.AddField_management(fc, 'NEW_FIELD_NAME', 'TEXT')
arcpy.CalculateField_management(fc, 'NEW_FIELD_NAME', ''.join(fields_to_join), 'PYTHON')
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to use some separator between values from different fields change '' in:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;''.join(fields_to_join)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;to 'separator' i.e.:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; '_'.join(fields_to_join) &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope it helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Arek&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:41:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-joinfield-management/m-p/626317#M48823</guid>
      <dc:creator>ArkadiuszMatoszka</dc:creator>
      <dc:date>2021-12-12T02:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Question about JoinField_Management??</title>
      <link>https://community.esri.com/t5/python-questions/question-about-joinfield-management/m-p/626318#M48824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Arek, my bad I forgot one layer is a gdb. Is this the right code for joining 2 fields in a shapefile and 2 fields in a gdb??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, traceback
from arcpy import env


mxd = arcpy.mapping.MapDocument("CURRENT")

# Join Fields
fc1 = 'K:\TASS\4_MAPPING_DATA_SUPPORT\Traffic_Mapping\Traffic_Count_Data\2011_Counts\2011_Annual_Stations\Annual_Stations_2011.shp'
fc2 = 'K:\TASS\4_MAPPING_DATA_SUPPORT\Traffic_Mapping\Traffic_Count_Data\District_Labels_Folder\Abilene_Labels.gdb'

fields_to_join = ['!F2011_TRAF!', '!FLAG!']
arcpy.AddField_management(fc1, 'COUNT', 'TEXT')
arcpy.CalculateField_management(fc1, 'COUNT', ''.join(fields_to_join), 'PYTHON')

fields_to_join = ['!TextString!', '!TFLAG!']
arcpy.AddField_management(fc2, 'TRAFFIC', 'TEXT')
arcpy.CalculateField-management(fc2, 'TRAFFIC', ''.join(fields_to_join), 'PYTHON')

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:41:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-joinfield-management/m-p/626318#M48824</guid>
      <dc:creator>MichelleCouden1</dc:creator>
      <dc:date>2021-12-12T02:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Question about JoinField_Management??</title>
      <link>https://community.esri.com/t5/python-questions/question-about-joinfield-management/m-p/626319#M48825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Answered my own question on this. Has to be workspace!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2013 19:56:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-joinfield-management/m-p/626319#M48825</guid>
      <dc:creator>MichelleCouden1</dc:creator>
      <dc:date>2013-04-30T19:56:41Z</dc:date>
    </item>
  </channel>
</rss>

