<?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: Calculate Field to get the value for field from combine data of other fileds in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1126749#M698</link>
    <description>&lt;P&gt;Thank a lot, I will try it.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Dec 2021 16:23:09 GMT</pubDate>
    <dc:creator>BinFeng_2021</dc:creator>
    <dc:date>2021-12-16T16:23:09Z</dc:date>
    <item>
      <title>Calculate Field to get the value for field from combine data of other fileds</title>
      <link>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1118787#M692</link>
      <description>&lt;P&gt;Hello, I try to use &lt;STRONG&gt;Calculate Field &lt;/STRONG&gt;to get the value for field “DESCRIPTION” from combine data of other fileds, as the image 1 attached.&lt;/P&gt;&lt;P&gt;However, my below first Syntax is not working &amp;nbsp;&lt;/P&gt;&lt;P&gt;arcpy.CalculateField_management(UT_CROSSING, "DISCREPTION", "[COMPANY]+\" \"+ [LOCATION]+\" \"+ [TYPE]+\" \"+\" SIZE=\"+ [SIZE]", "VB", "")&lt;/P&gt;&lt;P&gt;If I use below syntax, there no space between each field data, show as in image 2 arcpy.CalculateField_management("UT_CROSSING","DISCREPTION","!COMPANY!" + "&amp;nbsp; " + "!LOCATION!" + "&amp;nbsp; " + "!TYPE!" + "&amp;nbsp; " + "!SIZE!" ,"PYTHON")&lt;/P&gt;&lt;P&gt;It would be wonderful if you can tell me my mistake.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 17:55:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1118787#M692</guid>
      <dc:creator>BinFeng_2021</dc:creator>
      <dc:date>2021-11-19T17:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field to get the value for field from combine data of other fileds</title>
      <link>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1118799#M693</link>
      <description>&lt;P&gt;See if this works for you.&amp;nbsp; Not tested; no&amp;nbsp;guarantees...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

expression = f'{!COMPANY!} {!LOCATION!} {!TYPE!} {!SIZE!}'

arcpy.CalculateField_management("UT_CROSSING","DISCREPTION", expression, PYTHON3)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 18:30:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1118799#M693</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-11-19T18:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field to get the value for field from combine data of other fileds</title>
      <link>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1118808#M694</link>
      <description>&lt;P&gt;From your question&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;“DESCRIPTION”&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;from your code examples&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;"DISCREPTION"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;correct the spelling discrepancy and see if that fixes things&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 18:43:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1118808#M694</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-11-19T18:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field to get the value for field from combine data of other fileds</title>
      <link>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1119113#M695</link>
      <description>&lt;LI-CODE lang="python"&gt;#arcpy.CalculateField_management("UT_CROSSING","DISCREPTION","!COMPANY!" + "  " + "!LOCATION!" + "  " + "!TYPE!" + "  " + "!SIZE!" ,"PYTHON")
# this gives the following string, which isn't a valid python expression, into CalculateField:
#expr = "!COMPANY! !LOCATION! !TYPE! !SIZE!"

# What you want to do is something like this:
# Notice that the expression is wrapped in single quotes
expr = '!COMPANY! + " " + !LOCATION! + " " + !TYPE! + " " + !SIZE!'
# even better
expr = '" ".join([!COMPANY!, !LOCATION!, !TYPE!, !SIZE!])'

arcpy.CalculateField_management("UT_CROSSING","DISCREPTION",expr ,"PYTHON")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or use Arcade:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;expr = 'Concatenate([$feature.COMPANY, $feature.LOCATION, $feature.TYPE, $feature.SIZE], " ")'
arcpy.CalculateField_management("UT_CROSSING","DISCREPTION",expr ,"ARCADE")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 06:25:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1119113#M695</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-11-22T06:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field to get the value for field from combine data of other fileds</title>
      <link>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1126748#M697</link>
      <description>&lt;P&gt;Thanks, yes it is a typing mistake.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 16:22:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1126748#M697</guid>
      <dc:creator>BinFeng_2021</dc:creator>
      <dc:date>2021-12-16T16:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field to get the value for field from combine data of other fileds</title>
      <link>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1126749#M698</link>
      <description>&lt;P&gt;Thank a lot, I will try it.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 16:23:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/calculate-field-to-get-the-value-for-field-from/m-p/1126749#M698</guid>
      <dc:creator>BinFeng_2021</dc:creator>
      <dc:date>2021-12-16T16:23:09Z</dc:date>
    </item>
  </channel>
</rss>

