<?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: Can't calculate text into string field using CalculateField in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129814#M10108</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;arcpy&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;TempFC&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;"StoreID"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; Store&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;arcpy&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;TempFC&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;"StoreID"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; '"%s"' % Store&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I think when using strings instead of fields, you need to put the&amp;nbsp; &amp;nbsp;"&amp;nbsp; &amp;nbsp; &amp;nbsp; "&amp;nbsp; &amp;nbsp; &amp;nbsp;around the string, the same as if you were manually using field calculator.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Jun 2019 11:53:25 GMT</pubDate>
    <dc:creator>LukeWebb</dc:creator>
    <dc:date>2019-06-21T11:53:25Z</dc:date>
    <item>
      <title>Can't calculate text into string field using CalculateField</title>
      <link>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129809#M10103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am about to pull my hair out because in my newest script, I am attempting to use CalculateField to add text to a text field, and am getting some maddeningly inconsistent results.&amp;nbsp; The field length is 3, and I am attempting to simply calculate Yes or No into it, but it comes back with nulls every time I run it, with no error messages from the script.&amp;nbsp; However, the script also calculates a second text field with a length of 5 that is meant for zip codes (it is text in order to accommodate Canadian FSAs), and this calculation is successful for American-style five digit numeric zip codes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I tried using the Python interface in ArcMap to manually calculate the field in the layer, and&amp;nbsp;my results are shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;Integer, or integer within single quotes:&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Successful calculation.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;String with all letters&amp;nbsp;('Yes', 'No', 'ABC'), or alphanumeric string beginning with a letter ('A30'):&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Empty value for ObjectID = 1&lt;BR /&gt;The calculated value is invalid for the row with ObjectID = 1. For example, the calculated value may be too large for the field or you may be trying to add a string to a number field. This row will not be updated.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Do you want to process the rest of the rows? If the problem re-occurs while processing, this message will not be displayed. No messages will be generated if you click Yes. Click No to abort.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;Alphanumeric string beginning with a number ('30A'):&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;General error executing calculator.&lt;BR /&gt;ERROR 999999: Error executing function.&lt;BR /&gt;Expected end of statement&lt;BR /&gt;Failed to execute (CalculateField).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, these are string fields that should be able to accept any alphanumeric value I want to calculate into them.&amp;nbsp; I should also mention that if I edit the layer directly in ArcMap, I can successfully calculate text into the field that way, but I need the script to be able to do this as it is part of a cursor that repeats numerous times.&amp;nbsp; Has anyone else out there run into this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for your assistance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2019 17:09:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129809#M10103</guid>
      <dc:creator>StephenRhone</dc:creator>
      <dc:date>2019-06-19T17:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can't calculate text into string field using CalculateField</title>
      <link>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129810#M10104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The details are most likely in the script.&amp;nbsp; Could you post it and/or the relevant sections&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2019 17:13:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129810#M10104</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-06-19T17:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Can't calculate text into string field using CalculateField</title>
      <link>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129811#M10105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below is the relevant code.&amp;nbsp; In the store list table, the StoreID field is a four-digit number, but is stored as a text field, and MKTZip is the Yes/No field.&amp;nbsp; For each row in the cursor, it gets the store number and Yes/No value from the table, selects zip codes that meet those criteria, exports those to a temporary feature class, and is supposed to calculate the store number and Yes/No flag into the appropriate fields on lines 41 and 42.&amp;nbsp; The store number works, the Yes/No doesn't.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that the PrimaryFlag field is not null because when I have the script print the selection query in lines 13 and 14, the yes/no value shows up properly.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have even tried replacing the field name with {0}.format(PrimaryFlag), but this yields the same results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;    &lt;SPAN class="comment token"&gt;# Populate zip code assignment feature classes&lt;/SPAN&gt;
    timeprint&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Populating zip code assignment feature classes"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;StoreListTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'StoreID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'MKTZip'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# Set up cursor variables and temporary feature class and table&lt;/SPAN&gt;
            Store &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
            PrimaryFlag &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
            TempZipTableName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Zip_Table_"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; Store &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"_"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; PrimaryFlag
            TempZipTable &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; OutGDB &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\\"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; TempZipTableName
            TempFCName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Zip_FC_"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; Store &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"_"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; PrimaryFlag
            TempFC &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; OutGDB &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\\"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; TempFCName
            &lt;SPAN class="comment token"&gt;# Create temporary zip table of selected zips&lt;/SPAN&gt;
            SelectQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"StoreID = '{0}' AND MKTZip = '{1}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Store&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; PrimaryFlag&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"   "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; SelectQuery
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OutZipTableView&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; SelectQuery&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;TableToTable_conversion&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OutZipTableView&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OutGDB&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; TempZipTableName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OutZipTableView&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CLEAR_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# Build zip query and select zips from zip feature classes&lt;/SPAN&gt;
            ZipQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ZIP IN ('"&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TempZipTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'ZipCode'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; zipcursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; ziprow &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; zipcursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                    zip &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ziprow&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
                    ZipQuery &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; zip &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"', '"&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; zipcursor
            ZipQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ZipQuery&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
            ZipQuery &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;")"&lt;/SPAN&gt;
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OutAreaZipLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ZipQuery&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OutPointZipLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ZipQuery&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# Set up procedure to populate the zip assignment feature classes&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;PopulateAssignedZips&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; FC&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                &lt;SPAN class="comment token"&gt;# Get count of selected zips&lt;/SPAN&gt;
                ZipCount &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Lyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
                ZipInt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ZipCount&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
                &lt;SPAN class="comment token"&gt;# Proceed only if zips were selected&lt;/SPAN&gt;
                &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; ZipInt &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                    &lt;SPAN class="comment token"&gt;# Export to temporary feature class&lt;/SPAN&gt;
                    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FeatureClassToFeatureClass_conversion&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OutGDB&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; TempFCName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
                    &lt;SPAN class="comment token"&gt;# Clear selected features from zip layer&lt;/SPAN&gt;
                    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CLEAR_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
                    &lt;SPAN class="comment token"&gt;# Add store number and primary flag&lt;/SPAN&gt;
                    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TempFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"StoreID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Store&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
                    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TempFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"MKTZip"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; PrimaryFlag&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
                    &lt;SPAN class="comment token"&gt;# Append selected zips into zip assignment feature class&lt;/SPAN&gt;
                    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Append_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TempFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; FC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NO_TEST"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# Populate the zip assignment feature classes&lt;/SPAN&gt;
            PopulateAssignedZips&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OutAreaZipLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OutStoreAreaZipFC&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            PopulateAssignedZips&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OutPointZipLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; OutStorePointZipFC&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# Delete temporary zip table and feature class&lt;/SPAN&gt;
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TempZipTable&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TempFC&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; cursor‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:19:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129811#M10105</guid>
      <dc:creator>StephenRhone</dc:creator>
      <dc:date>2021-12-11T07:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can't calculate text into string field using CalculateField</title>
      <link>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129812#M10106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why is your 'def' (lines 30-44) within your cursor?&lt;/P&gt;&lt;P&gt;hard to follow, so I would throw a print statement in there so that the output going into calculate field can be seen.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And since you are trying to put X characters into a field of X width/size... does it work with a field of X+1 (or 2) in size?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am still questioning why the field size has to be the same width as your text&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2019 22:44:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129812#M10106</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-06-19T22:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can't calculate text into string field using CalculateField</title>
      <link>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129813#M10107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for taking a look at my code - I guess I put the function definition within the cursor for coding expediency.&amp;nbsp; And I tried increasing the field width, but this didn't change the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ultimately I was able to devise a workaround - since it appears I can calculate numeric values into the fields, even though I should be able to add text, I just had it put a 1 into the field where the flag value was "Yes," with 0 for "No."&amp;nbsp; Then after the cursor finished, I added a new text field to the feature class and had it calculate to Yes/No based on the 1/0 values in the other field - this was successful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is still bizarre that it wouldn't let me put text into a string field within the cursor, but at least I now have a working script that gives me the results I need, even if I had to go about it in a roundabout way.&amp;nbsp; Thanks for all your help; have a blessed day.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2019 15:47:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129813#M10107</guid>
      <dc:creator>StephenRhone</dc:creator>
      <dc:date>2019-06-20T15:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Can't calculate text into string field using CalculateField</title>
      <link>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129814#M10108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;arcpy&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;TempFC&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;"StoreID"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; Store&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;arcpy&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;TempFC&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;"StoreID"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; '"%s"' % Store&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I think when using strings instead of fields, you need to put the&amp;nbsp; &amp;nbsp;"&amp;nbsp; &amp;nbsp; &amp;nbsp; "&amp;nbsp; &amp;nbsp; &amp;nbsp;around the string, the same as if you were manually using field calculator.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2019 11:53:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129814#M10108</guid>
      <dc:creator>LukeWebb</dc:creator>
      <dc:date>2019-06-21T11:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can't calculate text into string field using CalculateField</title>
      <link>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129815#M10109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I should've known it'd come down to a syntax quirk - that did the trick!&amp;nbsp; Thanks so much for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2019 14:31:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-calculate-text-into-string-field-using/m-p/129815#M10109</guid>
      <dc:creator>StephenRhone</dc:creator>
      <dc:date>2019-06-21T14:31:19Z</dc:date>
    </item>
  </channel>
</rss>

