<?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: How to keep only numbers from string. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753527#M453686</link>
    <description>&lt;P&gt;Several good suggestions already, but I'll add two more suggestions for you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/83097"&gt;@HenryFoth_2021&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 1&lt;BR /&gt;&lt;/STRONG&gt;I notice that even if you have variable amounts of blank spaces, your source look structured. Could it be that we are looking at a fixed position text file, where field1 occupies the four first positions, field 2 position 5-12, field 12-18, etc? If so then you should not read the source with a delimiter, but as a fixed file. On a text file (MySource.txt) that looks like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;1900    0       0  0  1900     4    45   0  32    
2105    8       0  0  2113     7    35   0  44    
2164    15      0  0  2181     29   143  0  197   
2169    7774    0  0  9944     62   419  0  321  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;... the syntax would be something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD 
  //   [@1:8], 
  //   [@9:16], 
  //   [@17:19], 
  //   [@20:22], 
  [@23:31] as TheNumber, 
  //   [@32:36], 
  //   [@37:41], 
  //   [@42:44], 
  //   [@45:n]
FROM
MySource.txt
(fix, utf8, no labels);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 2&lt;/STRONG&gt;&lt;BR /&gt;You can re-read the field content as a source using&amp;nbsp; using FROM_FIELD. My experience is that when using LOAD FROM_FIELD multiple blanks will be ingored and handled as one. Syntax would be something similar to this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD 
     @5 as TheNumber
FROM_FIELD
(MyTable, FieldContainginTableInfo)
(txt, utf8, no labels, delimiter is spaces, msq);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 18 Oct 2020 20:24:02 GMT</pubDate>
    <dc:creator>Vegar</dc:creator>
    <dc:date>2020-10-18T20:24:02Z</dc:date>
    <item>
      <title>How to keep only numbers from string.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753338#M453675</link>
      <description>&lt;P&gt;Hi Community.&lt;/P&gt;&lt;P&gt;I'm having some trouble trying to keep only 1 set of numbers from a string. The set of numbers are separated by spaces. The mount of spaces and numbers are not always the same. The only thing that is the same is the mount of set of numbers, 9.&lt;/P&gt;&lt;P&gt;Here an example of data set:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HenryFoth_Sabre_0-1602870662189.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/42490i018473CD41C135EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HenryFoth_Sabre_0-1602870662189.png" alt="HenryFoth_Sabre_0-1602870662189.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The set I wish to keep is the one painted in yellows.&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 17:57:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753338#M453675</guid>
      <dc:creator>HenryFoth_2021</dc:creator>
      <dc:date>2024-11-16T17:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep only numbers from string.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753349#M453676</link>
      <description>&lt;P&gt;please elaborate. not clear what you mean by 'mount of numbers'&lt;/P&gt;&lt;P&gt;is the string 1 line in your picture ? and you want to get the yellow from that string?&lt;/P&gt;&lt;P&gt;did you try index or textbetween functions?&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;=TextBetween('2169 7775 0 0 9944 62 419 0 329',' ', ' ',4) returns 9944&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 18:45:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753349#M453676</guid>
      <dc:creator>dplr-rn</dc:creator>
      <dc:date>2020-10-16T18:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep only numbers from string.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753353#M453677</link>
      <description>&lt;P&gt;My solution to your problem doesn't seem like the ideal way to do this... but in your script, you can pull your string field in like below to get your highlighted values:&lt;/P&gt;&lt;P&gt;(MyString represents whatever your fieldname is)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;LOAD&amp;nbsp;&lt;/P&gt;&lt;P&gt;subfield(ltrim(mid(ltrim(mid(ltrim(mid(trim(mid(MyString,index(MyString,' '))), index(trim(mid(MyString,index(MyString,' '))),' ',1))), index(ltrim(mid(trim(mid(MyString,index(MyString,' '))), index(trim(mid(MyString,index(MyString,' '))),' ',1))),' '))),&lt;BR /&gt;index(ltrim(mid(ltrim(mid(trim(mid(MyString,index(MyString,' '))), index(trim(mid(MyString,index(MyString,' '))),' ',1))), index(ltrim(mid(trim(mid(MyString,index(MyString,' '))), index(trim(mid(MyString,index(MyString,' '))),' ',1))),' '))),' '))),' ',1) as MyString&lt;/P&gt;&lt;P&gt;FROM [your file path];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 19:27:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753353#M453677</guid>
      <dc:creator>benvatvandata</dc:creator>
      <dc:date>2020-10-16T19:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep only numbers from string.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753359#M453678</link>
      <description>&lt;P&gt;Similar to the other replies.&amp;nbsp; Replace a combination of&amp;nbsp; space and number with '|' that will be the delimiter.&amp;nbsp; Then replace spaces with nothing.&amp;nbsp; The use the&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/StringFunctions/SubField.htm" target="_self"&gt;SubField&lt;/A&gt;&amp;nbsp; function to get the 5th field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SubField(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(STR,' 0','|0'),' 1','|1'),' 2','|2'),' 3','|3'),' 4','|4'),' 5','|5'),' 6','|6'),' 7','|7'),' 8','|8'),' 9','|9'),' ',''),'|',5)&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 19:51:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753359#M453678</guid>
      <dc:creator>jwjackso</dc:creator>
      <dc:date>2020-10-16T19:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep only numbers from string.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753373#M453679</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/83097"&gt;@HenryFoth_2021&lt;/a&gt;&amp;nbsp; try below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Data:
LOAD *
where Sequence=4;
LOAD *,
     AutoNumber(Numbers,String) as Sequence
where IsNum(Numbers);
LOAD String,
     SubField(String,' ') as Numbers 
Inline [
String
191    11  23     666 12   34  4
123  2333  56     445   344   55 4 ];

DROP Fields Sequence;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 21:46:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753373#M453679</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-10-16T21:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep only numbers from string.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753520#M453685</link>
      <description>&lt;P&gt;As others have suggested, &lt;FONT face="courier new,courier"&gt;SubField(myfield, ' ',5)&lt;/FONT&gt; is the way to go. The problem is the variable number of spaces between numbers. Here's how I normalize multiple spaces to one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;SpaceMap:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Mapping Load repeat(' ', RecNo()+1), ' '&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;AutoGenerate 20;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;and then when I load the number field use the map with a MapSubString.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;SubField(MapSubString('SpaceMap',mynum),' ',4)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2020 16:44:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753520#M453685</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2020-10-18T16:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep only numbers from string.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753527#M453686</link>
      <description>&lt;P&gt;Several good suggestions already, but I'll add two more suggestions for you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/83097"&gt;@HenryFoth_2021&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 1&lt;BR /&gt;&lt;/STRONG&gt;I notice that even if you have variable amounts of blank spaces, your source look structured. Could it be that we are looking at a fixed position text file, where field1 occupies the four first positions, field 2 position 5-12, field 12-18, etc? If so then you should not read the source with a delimiter, but as a fixed file. On a text file (MySource.txt) that looks like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;1900    0       0  0  1900     4    45   0  32    
2105    8       0  0  2113     7    35   0  44    
2164    15      0  0  2181     29   143  0  197   
2169    7774    0  0  9944     62   419  0  321  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;... the syntax would be something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD 
  //   [@1:8], 
  //   [@9:16], 
  //   [@17:19], 
  //   [@20:22], 
  [@23:31] as TheNumber, 
  //   [@32:36], 
  //   [@37:41], 
  //   [@42:44], 
  //   [@45:n]
FROM
MySource.txt
(fix, utf8, no labels);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 2&lt;/STRONG&gt;&lt;BR /&gt;You can re-read the field content as a source using&amp;nbsp; using FROM_FIELD. My experience is that when using LOAD FROM_FIELD multiple blanks will be ingored and handled as one. Syntax would be something similar to this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD 
     @5 as TheNumber
FROM_FIELD
(MyTable, FieldContainginTableInfo)
(txt, utf8, no labels, delimiter is spaces, msq);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2020 20:24:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753527#M453686</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-10-18T20:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep only numbers from string.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753849#M453696</link>
      <description>&lt;P&gt;Thanks all for the replies and possible solutions.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/25001"&gt;@Vegar&lt;/a&gt;&amp;nbsp;, yours worked wonderful.&lt;/P&gt;&lt;P&gt;This community is awesome! Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 18:10:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-keep-only-numbers-from-string/m-p/1753849#M453696</guid>
      <dc:creator>HenryFoth_2021</dc:creator>
      <dc:date>2020-10-19T18:10:27Z</dc:date>
    </item>
  </channel>
</rss>

