<?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: Syntax for arcpy.management.CalculateField in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/syntax-for-arcpy-management-calculatefield/m-p/1412578#M82137</link>
    <description>&lt;P&gt;You are passing expression type, which is the fourth parameter, as the second parameter, which is field.&amp;nbsp; Also, when you pass the second parameter, you don't put it in square brackets, which creates a Python list and will cause another error.&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.management.CalculateField(out_fc, "SEGMENT", r"!STRUCTUREBEG! + ' to ' + !STRUCTUREEND!", "PYTHON3")&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 19 Apr 2024 23:43:39 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2024-04-19T23:43:39Z</dc:date>
    <item>
      <title>Syntax for arcpy.management.CalculateField</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/syntax-for-arcpy-management-calculatefield/m-p/1412574#M82135</link>
      <description>&lt;P&gt;I am trying to do a simple thing, I think, in Python.&amp;nbsp; I am very new to actually trying to write any Python code myself so please have mercy.&lt;/P&gt;&lt;P&gt;I have a script that defines an in-fc and an out-fc.&amp;nbsp; The in-feature is exported to the out_fc.&amp;nbsp; Then there are a bunch of fields that are deleted from the out_fc.&amp;nbsp; Then a field in the out_fc needs to be calculated using 2 fields that exist in the out_fc: STRUCTUREBEG and STRUCTUREEND.&amp;nbsp; The line of code that I am unsuccessfully using is the following:&lt;/P&gt;&lt;P&gt;arcpy.management.CalculateField (out_fc, "PYTHON3", ["SEGMENT"], ["!STRUCTUREBEG!+\" to \"+ !STRUCTUREEND!"])&lt;/P&gt;&lt;P&gt;SEGMENT is the field I want to populate with STRUCTUREBEG and STRUCTUREEND in the format STRUCTUREBEG to STRUCTUREEND.&amp;nbsp; The resulting field should be full of strings like this:&lt;/P&gt;&lt;P&gt;0-1 to 1-1&lt;BR /&gt;1-1 to 1-2&lt;BR /&gt;1-2 to 1-3&lt;/P&gt;&lt;P&gt;I have gone around and around trying to get the syntax right and my errors just get worse and worse.&amp;nbsp; I think this is simple, but I am not finding a solution.&amp;nbsp; Perhaps someone out there can set me straight?&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&lt;BR /&gt;Caitlin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2024 23:27:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/syntax-for-arcpy-management-calculatefield/m-p/1412574#M82135</guid>
      <dc:creator>CaitlinBernier1</dc:creator>
      <dc:date>2024-04-19T23:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for arcpy.management.CalculateField</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/syntax-for-arcpy-management-calculatefield/m-p/1412578#M82137</link>
      <description>&lt;P&gt;You are passing expression type, which is the fourth parameter, as the second parameter, which is field.&amp;nbsp; Also, when you pass the second parameter, you don't put it in square brackets, which creates a Python list and will cause another error.&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.management.CalculateField(out_fc, "SEGMENT", r"!STRUCTUREBEG! + ' to ' + !STRUCTUREEND!", "PYTHON3")&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 19 Apr 2024 23:43:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/syntax-for-arcpy-management-calculatefield/m-p/1412578#M82137</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2024-04-19T23:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for arcpy.management.CalculateField</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/syntax-for-arcpy-management-calculatefield/m-p/1412580#M82138</link>
      <description>&lt;P&gt;Joshua,&lt;/P&gt;&lt;P&gt;Thank you very much. That solved my issue and I have marked your note as a solution.&amp;nbsp; I really appreciate your taking the time to help me out, especially late on a Friday night!&lt;/P&gt;&lt;P&gt;Caitlin&lt;/P&gt;</description>
      <pubDate>Sat, 20 Apr 2024 00:16:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/syntax-for-arcpy-management-calculatefield/m-p/1412580#M82138</guid>
      <dc:creator>CaitlinBernier1</dc:creator>
      <dc:date>2024-04-20T00:16:49Z</dc:date>
    </item>
  </channel>
</rss>

