<?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: extract a numeric value from a text string, with the field calculator in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1169945#M54667</link>
    <description>&lt;P&gt;The Name column looks like a string representation of a Python tuple containing a str and int., so using Python &lt;A href="https://docs.python.org/3/library/functions.html#eval" target="_self"&gt;eval&lt;/A&gt; built-in should work:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;gt;&amp;gt;&amp;gt; a = "('tienda la samaritana', 100)"
&amp;gt;&amp;gt;&amp;gt; eval(a)[1]
100
&amp;gt;&amp;gt;&amp;gt; &lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 02 May 2022 22:28:10 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2022-05-02T22:28:10Z</dc:date>
    <item>
      <title>extract a numeric value from a text string, with the field calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1168141#M54445</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;I need to copy only the numerical value and paste it in a new column&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;using the field calculator&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="97.87234042553192%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Name&lt;/TD&gt;&lt;TD width="50%"&gt;New_value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;('tienda la samaritana', 100)&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;('tienda ferco', 64)&lt;/TD&gt;&lt;TD width="50%"&gt;64&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 26 Apr 2022 21:54:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1168141#M54445</guid>
      <dc:creator>Operativo_GISRTM_GIS</dc:creator>
      <dc:date>2022-04-26T21:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: extract a numeric value from a text string, with the field calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1168148#M54446</link>
      <description>&lt;P&gt;Does it matter which coding language you use?&lt;/P&gt;&lt;P&gt;Is the "Name" column consistently formatted?&lt;/P&gt;&lt;P&gt;Will there ever be numbers in the first part of the string?&lt;/P&gt;&lt;P&gt;If the number is always at the end of the string like that, you could use&amp;nbsp;&lt;STRONG&gt;Split&lt;/STRONG&gt;,&amp;nbsp;&lt;STRONG&gt;Left&lt;/STRONG&gt;, and&amp;nbsp;&lt;STRONG&gt;Count&lt;/STRONG&gt; to accomplish this in Arcade.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var test_string = "('tienda la samaritana', 100)"

var split_string = Split(test_string, ',')
Console(split_string)

var number_portion = split_string[-1]
Console(number_portion)

var the_number = Left(number_portion, Count(number_portion) - 1)
Console(the_number)

return Number(the_number)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Here's the console:&lt;/P&gt;&lt;PRE&gt;["('tienda la samaritana'"," 100)"]
 100)
 100&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;And here's the output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1651010638258.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/39903iD43446EDB7ECE558/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1651010638258.png" alt="jcarlson_0-1651010638258.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you prefer to use Python, you could probably get this done with a regular expression.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 22:04:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1168148#M54446</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-04-26T22:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: extract a numeric value from a text string, with the field calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1168156#M54447</link>
      <description>&lt;P&gt;If there are no other numbers as in the examples you have shown...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a = "('tienda la samaritana', 100)"

b = int("".join([i for i in a if i.isnumeric()]))

b
100&lt;/LI-CODE&gt;&lt;P&gt;as a field calculator expression replace 'a' with !YourFieldName! and don't assign it to b,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 22:25:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1168156#M54447</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-04-26T22:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: extract a numeric value from a text string, with the field calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1168160#M54449</link>
      <description>&lt;P&gt;Does it matter which coding language you use?&amp;nbsp;&lt;STRONG&gt;Python&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is the "Name" column consistently formatted? &lt;STRONG&gt;string&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Will there ever be numbers in the first part of the string? &lt;STRONG&gt;it´s Possible&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 22:38:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1168160#M54449</guid>
      <dc:creator>Operativo_GISRTM_GIS</dc:creator>
      <dc:date>2022-04-26T22:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: extract a numeric value from a text string, with the field calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1168210#M54457</link>
      <description>&lt;LI-CODE lang="python"&gt;import re

def extract_number(txt):
    numbers = re.findall(r"\d+", txt)
    if not numbers:
        return None
    return numbers[0]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 27 Apr 2022 06:57:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1168210#M54457</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-04-27T06:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: extract a numeric value from a text string, with the field calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1169945#M54667</link>
      <description>&lt;P&gt;The Name column looks like a string representation of a Python tuple containing a str and int., so using Python &lt;A href="https://docs.python.org/3/library/functions.html#eval" target="_self"&gt;eval&lt;/A&gt; built-in should work:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;gt;&amp;gt;&amp;gt; a = "('tienda la samaritana', 100)"
&amp;gt;&amp;gt;&amp;gt; eval(a)[1]
100
&amp;gt;&amp;gt;&amp;gt; &lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 02 May 2022 22:28:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extract-a-numeric-value-from-a-text-string-with/m-p/1169945#M54667</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2022-05-02T22:28:10Z</dc:date>
    </item>
  </channel>
</rss>

