<?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: arcpy calculatefieldmanagement domain field in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13351#M1061</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/34565"&gt;Randy Burton&lt;/A&gt;‌, the single-quoted text strings are not unique to domains.&amp;nbsp; In ArcGIS Desktop/ArcMap, Calculate Field has always required Python strings to be wrapped in single quotes to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Jun 2020 15:58:39 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2020-06-17T15:58:39Z</dc:date>
    <item>
      <title>arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13344#M1054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, using arcpy I'm trying to calculate a field that's using a domain. I'm actually calculating 2 fields, one after the other.&lt;/P&gt;&lt;P&gt;The first one works but the second one doesn't set it's new value. No error messages. If I'm not using python and just field calculate it "USER" puts "&lt;SPAN&gt;User-Derived" in the field. However my script just doesn't.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ArcMap 10.6 with a File GeoDataBase Featureclass&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;BR /&gt; # Execute CalculateField&lt;/P&gt;&lt;P&gt;# this one works well.&lt;BR /&gt; arcpy.CalculateField_management(ug, "MEASUREDLENGTH", dist, "PYTHON_9.3")&lt;BR /&gt; arcpy.AddMessage("Calc'd MEASUREDLENGTH")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# this one is supposed to end up with "User-Derived" but doesn't do anything&lt;BR /&gt; arcpy.CalculateField_management(ug, "LENGTHSOURCE", "USER", "PYTHON_9.3")&lt;BR /&gt; arcpy.AddMessage("Calc'd LENGTHSOURCE")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Domain Key/Value:&lt;BR /&gt;FM Field Measurement&lt;BR /&gt;MS Mapping System&lt;BR /&gt;USER User-Derived&lt;BR /&gt;WM Windmil&lt;BR /&gt;WO Work Order Package&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 16:03:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13344#M1054</guid>
      <dc:creator>BillChappell</dc:creator>
      <dc:date>2020-06-16T16:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13345#M1055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the syntax for the command:&lt;/P&gt;&lt;PRE class="" style="color: #4c4c4c; background-color: #ffffff; font-size: 17px; margin-bottom: 1.55rem;"&gt;CalculateField(in_table, field, expression, {expression_type}, {code_block}, {field_type})&lt;/PRE&gt;&lt;P&gt;It appears to me you are using&amp;nbsp; the domain name as the expression parameter.&amp;nbsp; Have you tried using the actual value of '&lt;SPAN style="background-color: #ffffff;"&gt;User-Derived' ?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 16:57:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13345#M1055</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-06-16T16:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13346#M1056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've tried the value&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;User-Derived' and the key 'USER', and no luck. I've used the key outside of python and it populates with the value but not in my script.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;I can populate the MEASUREDLENGTH field with a value in python without a problem, but that domain field is failing.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 17:24:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13346#M1056</guid>
      <dc:creator>BillChappell</dc:creator>
      <dc:date>2020-06-16T17:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13347#M1057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arcmap 10.6 is the 64 bit flavor of python 2.7 as I recall.&amp;nbsp; I wonder two things and they are total WAGs (wild a$$ guess):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What if you drop the&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"PYTHON_9.3"&amp;nbsp; reference altogether?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Could the '-' in User-Derived be derailing things?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;When I was using 10.6 I do recall there were some bizarre gotchas in python that would goof our scheduled tasks.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2020 17:52:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13347#M1057</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-06-16T17:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13348#M1058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I like to test field calculations with the&amp;nbsp;&lt;A href="https://desktop.arcgis.com/en/arcmap/10.6/tools/data-management-toolbox/calculate-field.htm"&gt;CalculateField&lt;/A&gt; tool and then look at the results window and 'copy as Python snippet'.&amp;nbsp; When this was done, I noticed that the domain code was wrapped in single quotes and then wrapped in double quotes.&amp;nbsp; So try:&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;arcpy.CalculateField_management(ug, "LENGTHSOURCE", "'USER'", "PYTHON_9.3")&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also noticed most of your domain codes are 2 characters.&amp;nbsp; If you still have issues, you may wish to confirm that 'USER' is the correct code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 03:25:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13348#M1058</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2020-06-17T03:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13349#M1059</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/4422"&gt;Joe Borgione&lt;/A&gt;‌, no version of ArcMap has or will come with 64-bit Python.&amp;nbsp; ArcMap is and will remain a 32-bit application bundled with 32-bit Python.&amp;nbsp; That said, if someone installs the Background Geoprocessing (64-bit) component, then they will have both a 32-bit and 64-bit Python for ArcGIS Desktop on their machine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 14:53:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13349#M1059</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-06-17T14:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13350#M1060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG style="background-color: #ffffff; "&gt;they will have both a 32-bit and 64-bit Python for ArcGIS Desktop on their machine.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Ahh;&amp;nbsp; now I recall the problem I had; since I had pro installed on my desktop, I was developing my scripts we used for scheduled tasks in 64 bit python.&amp;nbsp; But...&amp;nbsp; The server that runs the&amp;nbsp; scheduled tasks only had 32 bit (and 2.x python) so things got messy for us, especially when migrating existing scripts to python 3.x...&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 15:00:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13350#M1060</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-06-17T15:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13351#M1061</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/34565"&gt;Randy Burton&lt;/A&gt;‌, the single-quoted text strings are not unique to domains.&amp;nbsp; In ArcGIS Desktop/ArcMap, Calculate Field has always required Python strings to be wrapped in single quotes to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2020 15:58:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13351#M1061</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-06-17T15:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13352#M1062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure what caused my error, tried modelbuilder and exported that to python, While modelbuilder worked I noticed it had a couple intermediate variables created, and didn't work in my script. Leading me to believe I screwed up elsewhere and this was a result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frustrated I just decided to go with a updateCursor and that worked the first time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Ucursor = arcpy.UpdateCursor(oh, query) &lt;BR /&gt;&amp;nbsp; &amp;nbsp; for row in Ucursor: &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for fieldname, value in (('MEASUREDLENGTH', '100'), &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ('LENGTHSOURCE', 'USER')):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; row.setValue(fieldname, value) &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Ucursor.updateRow(row) &lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2020 21:03:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13352#M1062</guid>
      <dc:creator>BillChappell</dc:creator>
      <dc:date>2020-06-18T21:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13353#M1063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's great you were able to export a model to python and get to work right out of the box!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2020 21:24:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13353#M1063</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-06-18T21:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13354#M1064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you plan on learning about cursors and using them more often, I suggest you switch to using the ArcPy Data Access cursors, they perform much faster and are more Pythonic:&amp;nbsp; &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/data-access/updatecursor-class.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/data-access/updatecursor-class.htm"&gt;UpdateCursor—Data Access module | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2020 22:24:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13354#M1064</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-06-18T22:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy calculatefieldmanagement domain field</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13355#M1065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I have used both, this was the first one I saw when I googled it. Since I’m updating less than 2,000 records a time this is still very fast. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sent from my iPhone&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2020 23:36:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-calculatefieldmanagement-domain-field/m-p/13355#M1065</guid>
      <dc:creator>BillChappell</dc:creator>
      <dc:date>2020-06-18T23:36:22Z</dc:date>
    </item>
  </channel>
</rss>

