<?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: Delete the last 5 characters in a field in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453179#M25861</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Python parser&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; a = "MAPLE GROVE MN 55369-3466"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; b = a[:-5]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; b&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'MAPLE GROVE MN 55369'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;with appropriate changes for the field name&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 May 2014 17:19:07 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2014-05-15T17:19:07Z</dc:date>
    <item>
      <title>Delete the last 5 characters in a field</title>
      <link>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453178#M25860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to delete the last 5 characters in a field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Example: MAPLE GROVE MN&amp;nbsp; 55369-3466&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to delete "-3466" where -3466 is not the value in all records.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;~Julie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 16:53:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453178#M25860</guid>
      <dc:creator>JulieHines</dc:creator>
      <dc:date>2014-05-15T16:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Delete the last 5 characters in a field</title>
      <link>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453179#M25861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Python parser&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; a = "MAPLE GROVE MN 55369-3466"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; b = a[:-5]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; b&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'MAPLE GROVE MN 55369'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;with appropriate changes for the field name&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 17:19:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453179#M25861</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-05-15T17:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Delete the last 5 characters in a field</title>
      <link>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453180#M25862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dan's method works if all values have a suffix like '-1234'. But if some records don't have that, e.g. they just have the 5 digit zip, you'll be getting rid of that part of the field and would end up with no zip. You might want to try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; a = "MAPLE GROVE MN 55369-3466"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; lst = a.split('-')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; if len(lst) &amp;gt; 1:&amp;nbsp; # i.e., you have a '-' in the field&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b = lst[0]&amp;nbsp; # this is the value you want&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even this isn't foolproof, since a '-' anywhere in the field will get caught, for instance, a street named Sans-Souci. There are ways to catch that, but trying to keep it simple.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 18:30:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453180#M25862</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-05-15T18:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Delete the last 5 characters in a field</title>
      <link>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453181#M25863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Python parser&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; a = "MAPLE GROVE MN 55369-3466"&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; b = a[:-5]&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; b&lt;BR /&gt;'MAPLE GROVE MN 55369'&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; &lt;BR /&gt;with appropriate changes for the field name&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So what if I want to delete the last 5 characters of every record in a field?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 18:48:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453181#M25863</guid>
      <dc:creator>JulieHines</dc:creator>
      <dc:date>2014-05-15T18:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Delete the last 5 characters in a field</title>
      <link>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453182#M25864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;So what if I want to delete the last 5 characters of every record in a field?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With the caveat I posted above:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. In field calculator, switch the parser to Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Double click your field in the list to enter it in the calculation box.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Click =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Doubleclick your field again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5. Add this to your field in the calculation box, no spaces between the fieldname and the following: [:-5]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6. Click Ok.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe try this on a copy of your data first, just in case.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 18:59:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453182#M25864</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-05-15T18:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Delete the last 5 characters in a field</title>
      <link>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453183#M25865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;With the caveat I posted above:&lt;BR /&gt;&lt;BR /&gt;1. In field calculator, switch the parser to Python.&lt;BR /&gt;2. Double click your field in the list to enter it in the calculation box.&lt;BR /&gt;3. Click =&lt;BR /&gt;4. Doubleclick your field again.&lt;BR /&gt;5. Add this to your field in the calculation box, no spaces between the fieldname and the following: [:-5]&lt;BR /&gt;6. Click Ok.&lt;BR /&gt;&lt;BR /&gt;Maybe try this on a copy of your data first, just in case.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this look correct?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;!OWN_ADD_L2! = !OWN_ADD_L2![:-5]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 19:05:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453183#M25865</guid>
      <dc:creator>JulieHines</dc:creator>
      <dc:date>2014-05-15T19:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Delete the last 5 characters in a field</title>
      <link>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453184#M25866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looks ok to me...but try it on a copy first, I don't know your data like you do.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 19:14:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/delete-the-last-5-characters-in-a-field/m-p/453184#M25866</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-05-15T19:14:17Z</dc:date>
    </item>
  </channel>
</rss>

