<?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 number from even position of string and sum it in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2476039#M100229</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225019"&gt;@rob_vander&lt;/a&gt;&amp;nbsp; If you know maximum length of String which cannot exceed, you could follow below approach which is performant if your dataset is large.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// Generate even numbers for maximum length string&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;let vMaxEvenNumber = 20;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;for i=1 to '$(vMaxEvenNumber)'&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;even_number:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load $(i) as even_number&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;AutoGenerate 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;where even($(i))=-1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Next&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// Generate rangesum formula for each even number position of the string&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;let vFieldName = 'String'; // field name of string&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;formula:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load 'rangesum(' &amp;amp; Concat(formula,','&amp;amp; Chr(10),even_number) &amp;amp; ')' as formula;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load even_number,'mid($(vFieldName),'&amp;amp; even_number &amp;amp; ', 1)' as formula&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Resident even_number;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Drop Table even_number;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;let vFormula = Peek('formula');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Drop Table formula;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Data:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load ID,&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;$(vFormula)&amp;nbsp;as Value&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;FROM Table;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2024 09:50:50 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2024-08-13T09:50:50Z</dc:date>
    <item>
      <title>Extract number from even position of string and sum it</title>
      <link>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2475894#M100206</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I have weird requirement. I have below data. I want to extract number from even position (2nd,4th... ) of the String and sum those numbers to create Value field. I need help to create Value field in the script. My preference is script solution but I am fine with front ens solution if it is not complex.&lt;/P&gt;
&lt;TABLE width="328px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;ID&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;String&lt;/TD&gt;
&lt;TD width="187.016px"&gt;Value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;1&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;6&lt;FONT color="#FF0000"&gt;2&lt;/FONT&gt;7&lt;FONT color="#FF0000"&gt;5&lt;/FONT&gt;3&lt;FONT color="#FF0000"&gt;9&lt;/FONT&gt;0&lt;FONT color="#FF0000"&gt;7&lt;/FONT&gt;0&lt;FONT color="#FF0000"&gt;5&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="187.016px"&gt;2+5+9+7+5=&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;2&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;6&lt;FONT color="#FF0000"&gt;3&lt;/FONT&gt;4&lt;FONT color="#FF0000"&gt;9&lt;/FONT&gt;3&lt;FONT color="#FF0000"&gt;0&lt;/FONT&gt;4&lt;FONT color="#FF0000"&gt;9&lt;/FONT&gt;2&lt;FONT color="#FF0000"&gt;6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="187.016px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;3&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;3770493940&lt;/TD&gt;
&lt;TD width="187.016px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;4&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;3501712988&lt;/TD&gt;
&lt;TD width="187.016px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;5&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;2119488328&lt;/TD&gt;
&lt;TD width="187.016px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;6&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;879038653&lt;/TD&gt;
&lt;TD width="187.016px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;7&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;5498974641&lt;/TD&gt;
&lt;TD width="187.016px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;8&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;7644528791&lt;/TD&gt;
&lt;TD width="187.016px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;9&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;6174749785&lt;/TD&gt;
&lt;TD width="187.016px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="40px"&gt;10&lt;/TD&gt;
&lt;TD width="99.9844px"&gt;8965006299&lt;/TD&gt;
&lt;TD width="187.016px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 12 Aug 2024 15:59:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2475894#M100206</guid>
      <dc:creator>rob_vander</dc:creator>
      <dc:date>2024-08-12T15:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extract number from even position of string and sum it</title>
      <link>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2475957#M100216</link>
      <description>&lt;P&gt;How about:&lt;/P&gt;
&lt;PRE class="p1"&gt;&lt;SPAN class="s1"&gt;Data:&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;Load&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; * &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;Inline&lt;/SPAN&gt; [&lt;BR /&gt;ID,String&lt;BR /&gt;1,6275390705&lt;BR /&gt;2,6349304926&lt;BR /&gt;3,3770493940&lt;BR /&gt;4,3501712988&lt;BR /&gt;5,2119488328&lt;BR /&gt;6,879038653&lt;BR /&gt;7,5498974641&lt;BR /&gt;8,7644528791&lt;BR /&gt;9,6174749785&lt;BR /&gt;10,8965006299&lt;BR /&gt;]&lt;SPAN class="s1"&gt;&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;Values:&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;LOAD&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; &lt;BR /&gt;&lt;/SPAN&gt;  ID&lt;SPAN class="s1"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;  Sum&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;(&lt;/SPAN&gt;char&lt;SPAN class="s1"&gt;) &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;as&lt;/SPAN&gt; Value&lt;SPAN class="s1"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;Where&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;Even&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;(&lt;/SPAN&gt;Position&lt;SPAN class="s1"&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;Group&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;By&lt;/SPAN&gt; ID&lt;SPAN class="s1"&gt;&lt;BR /&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;LOAD&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;BR /&gt;&lt;/SPAN&gt;ID&lt;SPAN class="s1"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;  IterNo&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;() &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;as&lt;/SPAN&gt; Position&lt;SPAN class="s1"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;  Mid&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;(&lt;/SPAN&gt;String&lt;SPAN class="s1"&gt;,&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;IterNo&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;(), 1) &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;as&lt;/SPAN&gt; char&lt;SPAN class="s1"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;Resident&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; Data&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt;While&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;IterNo&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;() &amp;lt;= &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;len&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;(&lt;/SPAN&gt;String&lt;SPAN class="s1"&gt;)&lt;BR /&gt;; &lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&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;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 23:30:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2475957#M100216</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2024-08-12T23:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extract number from even position of string and sum it</title>
      <link>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2476039#M100229</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225019"&gt;@rob_vander&lt;/a&gt;&amp;nbsp; If you know maximum length of String which cannot exceed, you could follow below approach which is performant if your dataset is large.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// Generate even numbers for maximum length string&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;let vMaxEvenNumber = 20;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;for i=1 to '$(vMaxEvenNumber)'&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;even_number:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load $(i) as even_number&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;AutoGenerate 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;where even($(i))=-1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Next&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;// Generate rangesum formula for each even number position of the string&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;let vFieldName = 'String'; // field name of string&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;formula:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load 'rangesum(' &amp;amp; Concat(formula,','&amp;amp; Chr(10),even_number) &amp;amp; ')' as formula;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load even_number,'mid($(vFieldName),'&amp;amp; even_number &amp;amp; ', 1)' as formula&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Resident even_number;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Drop Table even_number;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;let vFormula = Peek('formula');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Drop Table formula;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Data:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load ID,&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;$(vFormula)&amp;nbsp;as Value&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;FROM Table;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 09:50:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2476039#M100229</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-08-13T09:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Extract number from even position of string and sum it</title>
      <link>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2476105#M100240</link>
      <description>&lt;P&gt;Thanks it works&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 15:33:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2476105#M100240</guid>
      <dc:creator>rob_vander</dc:creator>
      <dc:date>2024-08-13T15:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extract number from even position of string and sum it</title>
      <link>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2476106#M100241</link>
      <description>&lt;P&gt;This is something different way but my dataset is not huge so I have used other script suggestion. But it also works as we have fixed length String.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 15:35:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Extract-number-from-even-position-of-string-and-sum-it/m-p/2476106#M100241</guid>
      <dc:creator>rob_vander</dc:creator>
      <dc:date>2024-08-13T15:35:32Z</dc:date>
    </item>
  </channel>
</rss>

