<?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 text field in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578608#M92258</link>
    <description>&lt;PRE&gt;&lt;SPAN class=""&gt;Hello! There was a bit of an error when I pasted the examples. The bottom text string looks like this. [{"lamningstyp":"Fångstgrop","antal":4,"egenskap":"Bytesdjur: Älg/ren, Form: Rund"},{"lamningstyp":"Fångstgrop","antal":6,"egenskap":"Bytesdjur: Älg/ren, Form: Oval"}]:&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;In the example there are two numerical values ​​4 and 6 and I want the final result to be 10.&lt;/SPAN&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Jan 2025 12:44:04 GMT</pubDate>
    <dc:creator>Karl-JohanOlofsson</dc:creator>
    <dc:date>2025-01-24T12:44:04Z</dc:date>
    <item>
      <title>Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578583#M92255</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;Hello! I need help extracting numbers from a text field that contains both text and numbers.&lt;BR /&gt;The numbers must then be summed in a new column. I've tried using calylate field but can't get this to work.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;Below are some examples of a text string.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;[{"lamningstyp":"Kolningsanläggning","antal":1,"egenskap":"Typ: Kolbotten liggmila, Form: Rektangulär"},{"lamningstyp":"Husgrund, historisk tid","antal":3,"egenskap":"Verksamhet: Industri"},{"lamningstyp":"Träindustri","antal":1,"egenskap":"Verksamhet: Såg/Sågverk"},{"lamningstyp":"Kvarn","antal":1,"egenskap":"Typ: Hjulkvarn"},{"lamningstyp":"Brott/täkt","antal":1,"egenskap":"Material: Lera"}]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;[{"lamningstyp":"Fångstgrop","antal":4,"egenskap":"Bytesdjur: Älg/ren, Form: Rund"},{"lamningstyp":"Fångstgrop","antal":6,"egenskap":"Bytesdjur: Älg/ren, Form: Oval"}]:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 10:34:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578583#M92255</guid>
      <dc:creator>Karl-JohanOlofsson</dc:creator>
      <dc:date>2025-01-24T10:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578592#M92256</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/26194"&gt;@Karl-JohanOlofsson&lt;/a&gt;&amp;nbsp;you could do this with python:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;txt = '{"lamningstyp":"Fångstgrop","antal":4,"egenskap":"Bytesdjur: Älg/ren, Form: Rund"}'
[int(s) for s in txt if s.isdigit()][0]&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JakeSkinner_0-1737719704283.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/123966iAD0E1184760EB2EE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JakeSkinner_0-1737719704283.png" alt="JakeSkinner_0-1737719704283.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 11:55:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578592#M92256</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2025-01-24T11:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578608#M92258</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;Hello! There was a bit of an error when I pasted the examples. The bottom text string looks like this. [{"lamningstyp":"Fångstgrop","antal":4,"egenskap":"Bytesdjur: Älg/ren, Form: Rund"},{"lamningstyp":"Fångstgrop","antal":6,"egenskap":"Bytesdjur: Älg/ren, Form: Oval"}]:&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;In the example there are two numerical values ​​4 and 6 and I want the final result to be 10.&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jan 2025 12:44:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578608#M92258</guid>
      <dc:creator>Karl-JohanOlofsson</dc:creator>
      <dc:date>2025-01-24T12:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578610#M92259</link>
      <description>&lt;P&gt;Try the following:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;txt = '[{"lamningstyp":"Fångstgrop","antal":4,"egenskap":"Bytesdjur: Älg/ren, Form: Rund"},{"lamningstyp":"Fångstgrop","antal":6,"egenskap":"Bytesdjur: Älg/ren, Form: Oval"}]'
sum([int(s) for s in txt if s.isdigit()])&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JakeSkinner_0-1737723020066.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/123973i85C7E5494A73866D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JakeSkinner_0-1737723020066.png" alt="JakeSkinner_0-1737723020066.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 12:50:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578610#M92259</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2025-01-24T12:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578617#M92260</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;Yes, it works with that example but not when I try this one. [{"lamningstyp":"Kolningsanläggning","antal":1,"egenskap":"Typ: Kolbotten resmila, Form: Rund"},{"lamningstyp":"Kolningsanläggning","antal":2,"egenskap":"Typ: Övrig, Form: Oval"}] or this one [{"lamningstyp":"Övrigt","antal":1,"egenskap":null},{"lamningstyp":"Husgrund, historisk tid","antal":6,"egenskap":null},{"lamningstyp":"Kåta","antal":2,"egenskap":"Form: Rund"}] &lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 13:23:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578617#M92260</guid>
      <dc:creator>Karl-JohanOlofsson</dc:creator>
      <dc:date>2025-01-24T13:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578618#M92261</link>
      <description>&lt;P&gt;Can you send a screenshot of how the text appears in your attribute table?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 13:30:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578618#M92261</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2025-01-24T13:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578650#M92265</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;I am attaching a screenshot.&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jan 2025 14:29:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578650#M92265</guid>
      <dc:creator>Karl-JohanOlofsson</dc:creator>
      <dc:date>2025-01-24T14:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578683#M92272</link>
      <description>&lt;P&gt;I'm having trouble reproducing.&amp;nbsp; Here were the field values I used:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;[{"lamningstyp":"Fångstgrop","antal":4,"egenskap":"Bytesdjur: Älg/ren, Form: Rund"},{"lamningstyp":"Fångstgrop","antal":6,"egenskap":"Bytesdjur: Älg/ren, Form: Oval"}]&lt;/P&gt;&lt;P&gt;"[{""lamningstyp"":""Kolningsanläggning"",""antal"":1,""egenskap"":""Typ: Kolbotten liggmila, Form: Rektangulär""},{""lamningstyp"":""Husgrund, historisk tid"",""antal"":3,""egenskap"":""Verksamhet: Industri""},{""lamningstyp"":""Träindustri"",""antal"":1,""egenskap"":""Verksamhet: Såg/Sågverk""},{""lamningstyp"":""Kvarn"",""antal"":1,""egenskap"":""Typ: Hjulkvarn""},{""lamningstyp"":""Brott/täkt"",""antal"":1,""egenskap"":""Material: Lera""}]&lt;BR /&gt;[{""lamningstyp"":""Fångstgrop"",""antal"":4,""egenskap"":""Bytesdjur: Älg/ren, Form: Rund""},{""lamningstyp"":""Få"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the field calculator:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;sum([int(s) for s in !ing_lamn! if s.isdigit()])&lt;/LI-CODE&gt;&lt;P&gt;Below is the result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JakeSkinner_0-1737731430343.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/123992iB84A8118F9C55FEF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JakeSkinner_0-1737731430343.png" alt="JakeSkinner_0-1737731430343.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 15:12:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578683#M92272</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2025-01-24T15:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578699#M92273</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello! It seems like it works! I'm going to try a little more next week but thank you very much for the help!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 15:31:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578699#M92273</guid>
      <dc:creator>Karl-JohanOlofsson</dc:creator>
      <dc:date>2025-01-24T15:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578707#M92274</link>
      <description>&lt;P&gt;What you have is JSON data stored in a text field, so you should process it like JSON.&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;sum_json_key(!FieldName!, "antal")&lt;/LI-CODE&gt;&lt;P&gt;Code block:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import json
def sum_json_key(json_text, key):
    j = json.loads(json_text)
    return sum(i[key] for i in j)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 15:39:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1578707#M92274</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2025-01-24T15:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from a text field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1579436#M92346</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;Hello! The first method did not work fully while the JSON method worked perfectly. Thanks to everyone who helped with this!&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 08:26:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/extracting-numbers-from-a-text-field/m-p/1579436#M92346</guid>
      <dc:creator>Karl-JohanOlofsson</dc:creator>
      <dc:date>2025-01-28T08:26:39Z</dc:date>
    </item>
  </channel>
</rss>

