<?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: Extracting numbers from a column in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/extracting-numbers-from-a-column/m-p/671280#M38074</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Wayne_Whitley&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, have to understand your value is stored as double, and it sounds like you really want to extract string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, what if you had a double value as in the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; dblVal = 11705120000.999&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; print dblVal&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;11705120001.0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Depending on what you do with it, how you treat it, you may have some rounding...no worries though, and if you convert it to a different data type, as in the following to integer you don't have to worry about unexpected rounding values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; intVal = int(dblVal)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; print intVal&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;11705120000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, converting that result to string, you can 'slice off' what you need:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; strVal = str(intVal)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; print strVal&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;11705120000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; strVal[3:-3]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'05120'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have to be careful that the characters you wish to extract are in the same position in the integer value...otherwise you can test the input values and apply what techniques you need to conditionally extract the desired result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&amp;nbsp; I didn't realize this is the 'Editing' forum so the techique I use may look foreign -- the last 'slicing' technique I used above is also demonstrated along with the use of the field calculator here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Calculate Field examples &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Geodata » Data types » Tables&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//005s0000002m000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//005s0000002m000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(see under the heading near the top of the page, Simple string examples)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Jun 2013 18:06:31 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2013-06-18T18:06:31Z</dc:date>
    <item>
      <title>Extracting numbers from a column</title>
      <link>https://community.esri.com/t5/data-management-questions/extracting-numbers-from-a-column/m-p/671279#M38073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: powell21&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hey, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to execute a join of a table to a shapefile.&amp;nbsp; There is a column (in properties, type is "doube") in the shapefile that contains a long code (11 characters).&amp;nbsp; I need the middle five numbers to be in their own column in order to have it correspond to the correct column in the table.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i.e. Field in column = 11705120000 and I need 05120 to be in its own column for it to match up with the table correctly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to extract just those numbers, and if so, how?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Emily&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 17:26:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/extracting-numbers-from-a-column/m-p/671279#M38073</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-06-18T17:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a column</title>
      <link>https://community.esri.com/t5/data-management-questions/extracting-numbers-from-a-column/m-p/671280#M38074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Wayne_Whitley&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, have to understand your value is stored as double, and it sounds like you really want to extract string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, what if you had a double value as in the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; dblVal = 11705120000.999&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; print dblVal&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;11705120001.0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Depending on what you do with it, how you treat it, you may have some rounding...no worries though, and if you convert it to a different data type, as in the following to integer you don't have to worry about unexpected rounding values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; intVal = int(dblVal)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; print intVal&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;11705120000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, converting that result to string, you can 'slice off' what you need:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; strVal = str(intVal)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; print strVal&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;11705120000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; strVal[3:-3]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'05120'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have to be careful that the characters you wish to extract are in the same position in the integer value...otherwise you can test the input values and apply what techniques you need to conditionally extract the desired result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&amp;nbsp; I didn't realize this is the 'Editing' forum so the techique I use may look foreign -- the last 'slicing' technique I used above is also demonstrated along with the use of the field calculator here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Calculate Field examples &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Geodata » Data types » Tables&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//005s0000002m000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//005s0000002m000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(see under the heading near the top of the page, Simple string examples)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 18:06:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/extracting-numbers-from-a-column/m-p/671280#M38074</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-06-18T18:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a column</title>
      <link>https://community.esri.com/t5/data-management-questions/extracting-numbers-from-a-column/m-p/671281#M38075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;uh, thought something looked strange, and if you're checking out the documentation at the webhelp link provided in the last post, there is a bit of an error in the explanation for:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;!fieldname![1:4]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The result depicts the correct result 'sliced' from a string 'abcde' as being 'bcd' -- think of the character position indexes 0-5, and in the [1:4] expression, 4 is the 'upper bound' limit not included in the result.&amp;nbsp; In other words 4 - 1 = 3 characters to return starting at position 1, or 'b'.&amp;nbsp; (so the web doc explanation should not have included the fifth character)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You may have to play with it some...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 13:00:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/extracting-numbers-from-a-column/m-p/671281#M38075</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-06-20T13:00:21Z</dc:date>
    </item>
  </channel>
</rss>

